Fix recreating ServerSocket on error

This commit is contained in:
2021-03-28 01:16:40 +01:00
parent 0ffdc73a6d
commit 7329a2b9a5

View File

@@ -62,9 +62,10 @@ class Worker:
def _handle_client(self, conn: socket.socket, addr): def _handle_client(self, conn: socket.socket, addr):
handler = RequestHandler(conn, self.host)
while True: while True:
try: try:
handler = RequestHandler(conn, self.host)
handler.listen() handler.listen()
except HTTPServerCloseException as e: except HTTPServerCloseException as e:
logging.warning("[HTTP: %s] %s. Reason: %s", e.status_code, e.message, e.arg) logging.warning("[HTTP: %s] %s. Reason: %s", e.status_code, e.message, e.arg)