def test_process_queue(self): connect('test', func_handler) event_dict = {'args1': 1, 'arg2':2} post('test', **event_dict) post('test', event_dict) process_queue() self.failUnlessEqual(event_dict, Q.popleft()) self.failUnlessEqual(event_dict, Q.popleft())
def run(args): ''' Main loop for the client ''' post('join', host=HOST, port=PORT) stop = False while not stop: post('tick') stop = process_queue() asyncore.poll(0.002)
def run(args): ''' Main loop for the server ''' GAME.load_from_files(args.board) stop = False while not stop: post('tick') stop = process_queue() asyncore.poll(0.01)