Update
This commit is contained in:
@@ -5,7 +5,7 @@ import threading
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
from httplib.exceptions import HTTPServerException, InternalServerError
|
||||
from server.RequestHandler import RequestHandler
|
||||
from server.requesthandler import RequestHandler
|
||||
|
||||
THREAD_LIMIT = 128
|
||||
|
||||
@@ -62,15 +62,16 @@ class Worker:
|
||||
|
||||
def _handle_client(self, conn: socket.socket, addr):
|
||||
try:
|
||||
logging.debug("Handling client: %s", addr)
|
||||
|
||||
handler = RequestHandler(conn, self.host)
|
||||
handler.listen()
|
||||
except HTTPServerException as e:
|
||||
logging.debug("HTTP Exception:", exc_info=e)
|
||||
RequestHandler.send_error(conn, e.status_code, e.message)
|
||||
except socket.timeout:
|
||||
logging.debug("Socket for client %s timed out", addr)
|
||||
except Exception as e:
|
||||
RequestHandler.send_error(conn, InternalServerError.status_code, InternalServerError.message)
|
||||
logging.debug("Internal error", exc_info=e)
|
||||
RequestHandler.send_error(conn, InternalServerError.status_code, InternalServerError.message)
|
||||
|
||||
conn.shutdown(socket.SHUT_RDWR)
|
||||
conn.close()
|
||||
|
Reference in New Issue
Block a user