Fixed socket references. Closes #146.

pull/154/head
Mark Qvist 2022-11-03 19:51:04 +01:00
rodzic 87b73b6c67
commit f22e5cc200
1 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -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))