From 049733c4b69454b2c3b0645344aca9bbdfa4df96 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Tue, 13 Jun 2023 19:20:54 +0200 Subject: [PATCH] Fixed race condition for link initiators on timed out link establishment --- RNS/Link.py | 4 ++-- RNS/Transport.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/RNS/Link.py b/RNS/Link.py index 0b7b856..1e27f46 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -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 diff --git a/RNS/Transport.py b/RNS/Transport.py index e9c8d8a..f314175 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -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