From f22e5cc2002a0ecef64a1be6a1051f3dd2ea2cc6 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 3 Nov 2022 19:51:04 +0100 Subject: [PATCH] Fixed socket references. Closes #146. --- RNS/Interfaces/I2PInterface.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/RNS/Interfaces/I2PInterface.py b/RNS/Interfaces/I2PInterface.py index f1b0594..ee22dbc 100644 --- a/RNS/Interfaces/I2PInterface.py +++ b/RNS/Interfaces/I2PInterface.py @@ -527,18 +527,17 @@ class I2PInterfacePeer(Interface): self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1) self.socket.setsockopt(socket.IPPROTO_TCP, TCP_KEEPIDLE, int(I2PInterfacePeer.I2P_PROBE_AFTER)) - def shutdown_socket(self, socket): - if callable(socket.close): - + def shutdown_socket(self, target_socket): + if callable(target_socket.close): try: - if self.socket != None: - socket.shutdown(socket.SHUT_RDWR) + if socket != None: + target_socket.shutdown(socket.SHUT_RDWR) except Exception as e: RNS.log("Error while shutting down socket for "+str(self)+": "+str(e)) try: - if self.socket != None: - socket.close() + if socket != None: + target_socket.close() except Exception as e: RNS.log("Error while closing socket for "+str(self)+": "+str(e))