Improved interface detach on shared instance shutdown

This commit is contained in:
Mark Qvist 2025-01-16 14:12:30 +01:00
parent 4f4961257c
commit 1709cd929a

View File

@ -202,12 +202,14 @@ class TCPClientInterface(Interface):
self.detached = True
try:
self.socket.shutdown(socket.SHUT_RDWR)
if self.socket != None:
self.socket.shutdown(socket.SHUT_RDWR)
except Exception as e:
RNS.log("Error while shutting down socket for "+str(self)+": "+str(e))
try:
self.socket.close()
if self.socket != None:
self.socket.close()
except Exception as e:
RNS.log("Error while closing socket for "+str(self)+": "+str(e))