X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/static/gitweb.css?a=blobdiff_plain;f=server_%2Fio.py;h=95e7d7782f7eecf4ab318d330853cb2285881652;hb=6eae766d1b2cdfe0bdbaaabcbf00977a4df4fbbb;hp=e015b4f6f5cc14cbaeabc398223bf9c0ee7da7aa;hpb=6c2138deeea000ebb531203445fa22c1f7a6f0da;p=plomrogue2-experiments diff --git a/server_/io.py b/server_/io.py index e015b4f..95e7d77 100644 --- a/server_/io.py +++ b/server_/io.py @@ -31,9 +31,10 @@ class IO_Handler(socketserver.BaseRequestHandler): from the game IO loop via that new queue. At the same time, loops over socket's recv to get messages - from the outside via self.server.queue_out into the game IO - loop. Ends connection once a 'QUIT' message is received from - socket, and then also calls for a kill of its own queue. + from the outside into the game IO loop by way of + self.server.queue_out into the game IO. Ends connection once a + 'QUIT' message is received from socket, and then also calls + for a kill of its own queue. All messages to the game IO loop are tuples, with the first element a meta command ('ADD_QUEUE' for queue creation, @@ -110,10 +111,10 @@ def io_loop(q, game_command_handler): content = None if len(x) == 2 else x[2] if command_type == 'ADD_QUEUE': game_command_handler.queues_out[connection_id] = content - elif command_type == 'COMMAND': - game_command_handler.handle_input(content, connection_id) elif command_type == 'KILL_QUEUE': del game_command_handler.queues_out[connection_id] + elif command_type == 'COMMAND': + game_command_handler.handle_input(content, connection_id) def run_server_with_io_loop(command_handler):