Skip to content

Commit

Permalink
stable release v1
Browse files Browse the repository at this point in the history
  • Loading branch information
kianenigma committed Dec 6, 2017
1 parent a892e18 commit 253cd58
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions client/network/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down
2 changes: 1 addition & 1 deletion common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion server/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions server/network/udp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions test/console_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions test/das_config_console_control.json

This file was deleted.

4 changes: 3 additions & 1 deletion test/das_map.json
Original file line number Diff line number Diff line change
@@ -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}
]

0 comments on commit 253cd58

Please sign in to comment.