Improve documentation

This commit is contained in:
2021-03-28 18:54:52 +02:00
parent c748387b48
commit b7315c2348
11 changed files with 79 additions and 38 deletions

View File

@@ -48,7 +48,7 @@ class Worker:
@param host: The hostname of the HTTP server
@param name: The name of this Worker instance
@param queue: The dispatch queue for incoming socket connections
@param stop_event: The Event that signals when to shutdown this worker.
@param stop_event: The Event that signals when to shut down this worker.
"""
self.host = host
self.name = name
@@ -70,9 +70,9 @@ class Worker:
"""
while not self.stop_event.is_set():
# Blocks until thread is free
# Blocks until the thread is free
self.finished_queue.get()
# Blocks until new client connects
# Blocks until a new client connects
conn, addr = self.queue.get()
if conn is None or addr is None:
@@ -80,7 +80,7 @@ class Worker:
logging.debug("Processing new client: %s", addr)
# submit client to thread
# submit the client to the executor
self.executor.submit(self._handle_client, conn, addr)
self.shutdown()
@@ -145,8 +145,10 @@ class Worker:
self.executor.shutdown(False)
logging.info("Closing sockets")
# Copy dictionary to prevent issues with concurrency
clients = self.dispatched_sockets.copy().values()
for client in clients:
client: socket.socket
try: