mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-05-25 09:40:54 -04:00
Fixed potential unhandled exception on fast-flapping connections
This commit is contained in:
parent
9a1884cfec
commit
c398b34dd8
1 changed files with 47 additions and 41 deletions
|
@ -319,7 +319,8 @@ class BackboneInterface(Interface):
|
|||
client_socket, address = server_socket.accept()
|
||||
client_socket.setblocking(0)
|
||||
if not owner_interface.incoming_connection(client_socket):
|
||||
client_socket.close()
|
||||
try: client_socket.close()
|
||||
except Exception as e: RNS.log(f"Error while closing socket for failed incoming connection: {e}", RNS.LOG_ERROR)
|
||||
|
||||
elif fileno == server_socket.fileno() and (event & select.EPOLLHUP):
|
||||
try: BackboneInterface.deregister_fileno(fileno)
|
||||
|
@ -337,6 +338,7 @@ class BackboneInterface(Interface):
|
|||
|
||||
def incoming_connection(self, socket):
|
||||
RNS.log("Accepting incoming connection", RNS.LOG_VERBOSE)
|
||||
try:
|
||||
spawned_configuration = {"name": "Client on "+self.name, "target_host": None, "target_port": None}
|
||||
spawned_interface = BackboneClientInterface(self.owner, spawned_configuration, connected_socket=socket)
|
||||
spawned_interface.OUT = self.OUT
|
||||
|
@ -380,6 +382,10 @@ class BackboneInterface(Interface):
|
|||
self.spawned_interfaces.append(spawned_interface)
|
||||
BackboneInterface.add_client_socket(socket, spawned_interface)
|
||||
|
||||
except Exception as e:
|
||||
RNS.log(f"An error occurred while accepting incoming connection on {self}: {e}", RNS.LOG_ERROR)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def received_announce(self, from_spawned=False):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue