Fixed interface detachment on TCP initiator interfaces

This commit is contained in:
Mark Qvist 2021-10-08 17:06:00 +02:00
parent de800f0ea7
commit 60917f0eea
3 changed files with 11 additions and 3 deletions

View File

@ -275,7 +275,8 @@ class TCPClientInterface(Interface):
self.parent_interface.clients -= 1 self.parent_interface.clients -= 1
if self in RNS.Transport.interfaces: if self in RNS.Transport.interfaces:
RNS.Transport.interfaces.remove(self) if not self.initiator:
RNS.Transport.interfaces.remove(self)
def __str__(self): def __str__(self):

View File

@ -182,7 +182,7 @@ class Link:
self.start_watchdog() self.start_watchdog()
self.packet.send() self.packet.send()
self.had_outbound() self.had_outbound()
RNS.log("Link request "+RNS.prettyhexrep(self.link_id)+" sent to "+str(self.destination), RNS.LOG_VERBOSE) RNS.log("Link request "+RNS.prettyhexrep(self.link_id)+" sent to "+str(self.destination), RNS.LOG_DEBUG)
def load_peer(self, peer_pub_bytes, peer_sig_pub_bytes): def load_peer(self, peer_pub_bytes, peer_sig_pub_bytes):

View File

@ -698,7 +698,7 @@ class Transport:
# TODO: There should probably be some kind of REJECT # TODO: There should probably be some kind of REJECT
# mechanism here, to signal to the source that their # mechanism here, to signal to the source that their
# expected path failed. # expected path failed.
RNS.log("Got packet in transport, but no known path to final destination. Dropping packet.", RNS.LOG_DEBUG) RNS.log("Got packet in transport, but no known path to final destination "+RNS.prettyhexrep(packet.destination_hash)+". Dropping packet.", RNS.LOG_DEBUG)
# Link transport handling. Directs packets according # Link transport handling. Directs packets according
# to entries in the link tables # to entries in the link tables
@ -1095,6 +1095,7 @@ class Transport:
interface.tunnel_id = tunnel_id interface.tunnel_id = tunnel_id
paths = tunnel_entry[2] paths = tunnel_entry[2]
deprecated_paths = []
for destination_hash, path_entry in paths.items(): for destination_hash, path_entry in paths.items():
received_from = path_entry[1] received_from = path_entry[1]
announce_hops = path_entry[2] announce_hops = path_entry[2]
@ -1119,6 +1120,12 @@ class Transport:
if should_add: if should_add:
Transport.destination_table[destination_hash] = new_entry Transport.destination_table[destination_hash] = new_entry
RNS.log("Restored path to "+RNS.prettyhexrep(packet.destination_hash)+" is now "+str(announce_hops)+" hops away via "+RNS.prettyhexrep(received_from)+" on "+str(receiving_interface), RNS.LOG_DEBUG) RNS.log("Restored path to "+RNS.prettyhexrep(packet.destination_hash)+" is now "+str(announce_hops)+" hops away via "+RNS.prettyhexrep(received_from)+" on "+str(receiving_interface), RNS.LOG_DEBUG)
else:
deprecated_paths.append(destination_hash)
for deprecated_path in deprecated_paths:
RNS.log("Removing path to "+RNS.prettyhexrep(deprecated_path)+" from tunnel "+RNS.prettyhexrep(tunnel_id), RNS.LOG_DEBUG)
paths.pop(deprecated_path)