diff --git a/client/network/transport.py b/client/network/transport.py index 171fb72..9cfb7e4 100644 --- a/client/network/transport.py +++ b/client/network/transport.py @@ -145,6 +145,7 @@ def get_closest_server(self): udp_sock.close() return address + logger.warning("Attempt {}. No success with any server".format(count)) # terminate client after 5 unsuccessful tries if count > 5: logger.error('Could not connect to any server. Terminate.') diff --git a/common/constants.py b/common/constants.py index 1dc3549..3066713 100644 --- a/common/constants.py +++ b/common/constants.py @@ -14,7 +14,7 @@ class DIRECTIONS: class TRANSPORT: host = '0.0.0.0' port = 8000 - UDP_DELAY_PER_PLAYER = .05 + UDP_DELAY_PER_PLAYER = .001 class USERS: PLAYER = 'p' diff --git a/server/core/engine.py b/server/core/engine.py index cc24c5a..01f4255 100644 --- a/server/core/engine.py +++ b/server/core/engine.py @@ -83,7 +83,7 @@ def get_all_requests(self): for command in all_commands: if current_tick - command.timestamp < threshold : - logger.error("Putting back {}".format(command)) + logger.debug("Putting back {}".format(command)) self.request_queue.put(command) else: exec_commands.append(command) diff --git a/server/network/udp_server.py b/server/network/udp_server.py index 92ae524..67d3969 100644 --- a/server/network/udp_server.py +++ b/server/network/udp_server.py @@ -51,9 +51,8 @@ def on_message(self, data, address): :param data: the data received as a dictionary :param address: the udp address from where the received message was sent """ + logger.critical("UDP SERVER FROM {} => {}".format(data, address)) if data['type'] == MSG_TYPE.PING: - if self.delay <= 0: - self.delay = 0 time.sleep(self.delay) send_udp_message(self.socket, address, MSG_TYPE.PING) else: diff --git a/test/console_control.py b/test/console_control.py index e2d32db..013cdbd 100644 --- a/test/console_control.py +++ b/test/console_control.py @@ -24,8 +24,9 @@ def extract_id(text): class Server(object): @staticmethod def handle(text): - if text == 'server.init': - for i in range(1, 6): + if text.startswith('server.init'): + no = extract_id(text) + for i in range(1, no+1): if i == 1: Server.start(i, master_node=True) else: diff --git a/test/das_config_console_control.json b/test/das_config_console_control.json deleted file mode 100644 index b35a031..0000000 --- a/test/das_config_console_control.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "servers": ["127.0.0.1:10000", "127.0.0.1:20000", "127.0.0.1:30000", "127.0.0.1:40000", "127.0.0.1:50000"], - "peers": ["0.0.0.0:10010", "0.0.0.0:20010", "0.0.0.0:30010", "0.0.0.0:40010", "0.0.0.0:50010"] -} \ No newline at end of file diff --git a/test/das_map.json b/test/das_map.json index b90f3f1..5cedb29 100644 --- a/test/das_map.json +++ b/test/das_map.json @@ -1,4 +1,6 @@ [ {"type": "d", "r": 0, "c": 0}, - {"type": "d", "r": 10, "c": 10} + {"type": "d", "r": 22, "c": 22}, + {"type": "d", "r": 22, "c": 0}, + {"type": "d", "r": 0, "c": 22} ]