Improved daemon restart time on systems with many interfaces

This commit is contained in:
Mark Qvist 2025-01-16 17:48:16 +01:00
parent a56d93fc1e
commit ad1e6a41ee
3 changed files with 8 additions and 1 deletions

View file

@ -539,6 +539,7 @@ class TCPServerInterface(Interface):
else:
ThreadingTCPServer.allow_reuse_address = True
self.server = ThreadingTCPServer(bind_address, handlerFactory(self.incoming_connection))
self.server.daemon_threads = True
self.bitrate = TCPServerInterface.BITRATE_GUESS
@ -606,13 +607,15 @@ class TCPServerInterface(Interface):
pass
def detach(self):
self.detached = True
self.online = False
if self.server != None:
if hasattr(self.server, "shutdown"):
if callable(self.server.shutdown):
try:
RNS.log("Detaching "+str(self), RNS.LOG_DEBUG)
self.server.shutdown()
self.detached = True
self.server.server_close()
self.server = None
except Exception as e: