File transfer example

This commit is contained in:
Mark Qvist 2018-04-25 23:10:26 +02:00
parent aa9d0876d7
commit 4e136eea03

View File

@ -29,8 +29,8 @@ class Link:
# TODO: This should not be hardcoded, # TODO: This should not be hardcoded,
# but calculated from something like # but calculated from something like
# first-hop RTT latency and distance # first-hop RTT latency and distance
DEFAULT_TIMEOUT = 10.0 DEFAULT_TIMEOUT = 15.0
TIMEOUT_FACTOR = 5 TIMEOUT_FACTOR = 3
KEEPALIVE = 120 KEEPALIVE = 120
PENDING = 0x00 PENDING = 0x00
@ -225,7 +225,7 @@ class Link:
return None return None
def teardown(self): def teardown(self):
if self.status != Link.PENDING: if self.status != Link.PENDING and self.status != Link.CLOSED:
teardown_packet = RNS.Packet(self, self.link_id, context=RNS.Packet.LINKCLOSE) teardown_packet = RNS.Packet(self, self.link_id, context=RNS.Packet.LINKCLOSE)
teardown_packet.send() teardown_packet.send()
self.status = Link.CLOSED self.status = Link.CLOSED