Enhanced server error handling

Add signal handling for when the process is killed
This commit is contained in:
kale4eat
2024-03-06 12:13:27 +09:00
parent 45c6bde2e7
commit ed90af1b87
2 changed files with 16 additions and 0 deletions

View File

@@ -86,6 +86,12 @@ class WorkerServer:
self.client_count -= 1
logger.info("close connection")
continue
except Exception as e:
sock.close()
sockets.remove(sock)
self.client_count -= 1
logger.error(e)
continue
logger.trace(f"server received request: {request}")