From 1709cd929acfdd069418aa16683755a7210d386d Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 16 Jan 2025 14:12:30 +0100 Subject: [PATCH] Improved interface detach on shared instance shutdown --- RNS/Interfaces/TCPInterface.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RNS/Interfaces/TCPInterface.py b/RNS/Interfaces/TCPInterface.py index 8071b9b..d15d5a1 100644 --- a/RNS/Interfaces/TCPInterface.py +++ b/RNS/Interfaces/TCPInterface.py @@ -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))