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,
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):