Skip to content

Commit 5e39136

Browse files
committed
Fixed missing path state resetting on stale path rediscovery
1 parent 4b26a86 commit 5e39136

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

RNS/Transport.py

+19
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,7 @@ def inbound(raw, interface=None):
13491349
# TODO: Check whether this approach works
13501350
# under all circumstances
13511351
if not random_blob in random_blobs:
1352+
Transport.mark_path_unknown_state(packet.destination_hash)
13521353
should_add = True
13531354
else:
13541355
should_add = False
@@ -1376,6 +1377,7 @@ def inbound(raw, interface=None):
13761377
# TODO: Check that this ^ approach actually
13771378
# works under all circumstances
13781379
RNS.log("Replacing destination table entry for "+str(RNS.prettyhexrep(packet.destination_hash))+" with new announce due to expired path", RNS.LOG_DEBUG)
1380+
Transport.mark_path_unknown_state(packet.destination_hash)
13791381
should_add = True
13801382
else:
13811383
should_add = False
@@ -1386,6 +1388,7 @@ def inbound(raw, interface=None):
13861388
if (announce_emitted > path_announce_emitted):
13871389
if not random_blob in random_blobs:
13881390
RNS.log("Replacing destination table entry for "+str(RNS.prettyhexrep(packet.destination_hash))+" with new announce, since it was more recently emitted", RNS.LOG_DEBUG)
1391+
Transport.mark_path_unknown_state(packet.destination_hash)
13891392
should_add = True
13901393
else:
13911394
should_add = False
@@ -2097,6 +2100,22 @@ def mark_path_unresponsive(destination_hash):
20972100
else:
20982101
return False
20992102

2103+
@staticmethod
2104+
def mark_path_responsive(destination_hash):
2105+
if destination_hash in Transport.destination_table:
2106+
Transport.path_states[destination_hash] = Transport.STATE_RESPONSIVE
2107+
return True
2108+
else:
2109+
return False
2110+
2111+
@staticmethod
2112+
def mark_path_unknown_state(destination_hash):
2113+
if destination_hash in Transport.destination_table:
2114+
Transport.path_states[destination_hash] = Transport.STATE_UNKNOWN
2115+
return True
2116+
else:
2117+
return False
2118+
21002119
def path_is_unresponsive(destination_hash):
21012120
if destination_hash in Transport.path_states:
21022121
if Transport.path_states[destination_hash] == Transport.STATE_UNRESPONSIVE:

0 commit comments

Comments
 (0)