mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-05 05:40:14 +00:00
Link activation time
This commit is contained in:
parent
c96e067839
commit
20dfbcf0cc
@ -123,6 +123,7 @@ class Link:
|
|||||||
self.keepalive = Link.KEEPALIVE
|
self.keepalive = Link.KEEPALIVE
|
||||||
self.watchdog_lock = False
|
self.watchdog_lock = False
|
||||||
self.status = Link.PENDING
|
self.status = Link.PENDING
|
||||||
|
self.activated_at = None
|
||||||
self.type = RNS.Destination.LINK
|
self.type = RNS.Destination.LINK
|
||||||
self.owner = owner
|
self.owner = owner
|
||||||
self.destination = destination
|
self.destination = destination
|
||||||
@ -245,6 +246,7 @@ class Link:
|
|||||||
self.had_outbound()
|
self.had_outbound()
|
||||||
|
|
||||||
self.status = Link.ACTIVE
|
self.status = Link.ACTIVE
|
||||||
|
self.activated_at = time.time()
|
||||||
if self.callbacks.link_established != None:
|
if self.callbacks.link_established != None:
|
||||||
thread = threading.Thread(target=self.callbacks.link_established, args=(self,))
|
thread = threading.Thread(target=self.callbacks.link_established, args=(self,))
|
||||||
thread.setDaemon(True)
|
thread.setDaemon(True)
|
||||||
@ -334,6 +336,8 @@ class Link:
|
|||||||
rtt = umsgpack.unpackb(plaintext)
|
rtt = umsgpack.unpackb(plaintext)
|
||||||
self.rtt = max(measured_rtt, rtt)
|
self.rtt = max(measured_rtt, rtt)
|
||||||
self.status = Link.ACTIVE
|
self.status = Link.ACTIVE
|
||||||
|
self.activated_at = time.time()
|
||||||
|
|
||||||
|
|
||||||
if self.owner.callbacks.link_established != None:
|
if self.owner.callbacks.link_established != None:
|
||||||
self.owner.callbacks.link_established(self)
|
self.owner.callbacks.link_established(self)
|
||||||
|
@ -1032,6 +1032,9 @@ class Transport:
|
|||||||
# Handling for proofs and link-request proofs
|
# Handling for proofs and link-request proofs
|
||||||
elif packet.packet_type == RNS.Packet.PROOF:
|
elif packet.packet_type == RNS.Packet.PROOF:
|
||||||
if packet.context == RNS.Packet.LRPROOF:
|
if packet.context == RNS.Packet.LRPROOF:
|
||||||
|
# TODO: Remove debug
|
||||||
|
RNS.log("Link request proof received")
|
||||||
|
|
||||||
# This is a link request proof, check if it
|
# This is a link request proof, check if it
|
||||||
# needs to be transported
|
# needs to be transported
|
||||||
if (RNS.Reticulum.transport_enabled() or for_local_client_link or from_local_client) and packet.destination_hash in Transport.link_table:
|
if (RNS.Reticulum.transport_enabled() or for_local_client_link or from_local_client) and packet.destination_hash in Transport.link_table:
|
||||||
@ -1048,10 +1051,15 @@ class Transport:
|
|||||||
else:
|
else:
|
||||||
RNS.log("Link request proof received on wrong interface, not transporting it.", RNS.LOG_DEBUG)
|
RNS.log("Link request proof received on wrong interface, not transporting it.", RNS.LOG_DEBUG)
|
||||||
else:
|
else:
|
||||||
|
# TODO: Remove debug
|
||||||
|
RNS.log("Could not transport link request proof")
|
||||||
|
|
||||||
# Check if we can deliver it to a local
|
# Check if we can deliver it to a local
|
||||||
# pending link
|
# pending link
|
||||||
for link in Transport.pending_links:
|
for link in Transport.pending_links:
|
||||||
if link.link_id == packet.destination_hash:
|
if link.link_id == packet.destination_hash:
|
||||||
|
# TODO: Remove debug
|
||||||
|
RNS.log("Delivering link request proof to local pending link", RNS.LOG_DEBUG)
|
||||||
link.validate_proof(packet)
|
link.validate_proof(packet)
|
||||||
|
|
||||||
elif packet.context == RNS.Packet.RESOURCE_PRF:
|
elif packet.context == RNS.Packet.RESOURCE_PRF:
|
||||||
|
Loading…
Reference in New Issue
Block a user