From 109132e09dbecb8df2e9d4ea65a4e3ed6b0ded03 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 22 May 2022 15:43:46 +0200 Subject: [PATCH] Fixed expired AP and roaming paths not being removed at correct time. --- RNS/Transport.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/RNS/Transport.py b/RNS/Transport.py index 3c85cbb..50c33d9 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -384,7 +384,14 @@ class Transport: destination_entry = Transport.destination_table[destination_hash] attached_interface = destination_entry[5] - if time.time() > destination_entry[0] + Transport.DESTINATION_TIMEOUT: + if attached_interface != None and hasattr(attached_interface, "mode") and attached_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ACCESS_POINT: + destination_expiry = destination_entry[0] + Transport.AP_PATH_TIME + elif attached_interface != None and hasattr(attached_interface, "mode") and attached_interface.mode == RNS.Interfaces.Interface.Interface.MODE_ROAMING: + destination_expiry = destination_entry[0] + Transport.ROAMING_PATH_TIME + else: + destination_expiry = destination_entry[0] + Transport.DESTINATION_TIMEOUT + + if time.time() > destination_expiry: stale_paths.append(destination_hash) RNS.log("Path to "+RNS.prettyhexrep(destination_hash)+" timed out and was removed", RNS.LOG_DEBUG) elif not attached_interface in Transport.interfaces: