Fixed race condition for link initiators on timed out link establishment

This commit is contained in:
Mark Qvist 2023-06-13 19:20:54 +02:00
parent 420d58527d
commit 049733c4b6
2 changed files with 4 additions and 4 deletions

View File

@ -277,8 +277,8 @@ class Link:
signature = packet.data[:RNS.Identity.SIGLENGTH//8]
if self.destination.identity.validate(signature, signed_data):
if self.status != Link.PENDING:
raise IOError("Invalid link state for proof validation")
if self.status != Link.HANDSHAKE:
raise IOError("Invalid link state for proof validation: "+str(self.status))
self.rtt = time.time() - self.request_time
self.attached_interface = packet.receiving_interface

View File

@ -1741,8 +1741,8 @@ class Transport:
def activate_link(link):
RNS.log("Activating link "+str(link), RNS.LOG_EXTREME)
if link in Transport.pending_links:
if link.status != Link.PENDING:
raise IOError("Invalid link state for link activation")
if link.status != RNS.Link.ACTIVE:
raise IOError("Invalid link state for link activation: "+str(link.status))
Transport.pending_links.remove(link)
Transport.active_links.append(link)
link.status = RNS.Link.ACTIVE