summaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-21 12:17:17 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-21 12:17:17 -0300
commit08587596d01dd1456f9000258d01878a7c3780d0 (patch)
tree22fb80255cb02fb4f67c1c1df2758476b9673a36 /server.py
parentaa59cb6d6c1ae1d0d9bbe2ee8039e35645a07bb8 (diff)
downloadserver-08587596d01dd1456f9000258d01878a7c3780d0.tar.gz
server-08587596d01dd1456f9000258d01878a7c3780d0.tar.bz2
server-08587596d01dd1456f9000258d01878a7c3780d0.tar.xz
server-08587596d01dd1456f9000258d01878a7c3780d0.zip
Abrupt loss of connection will now save the player data and destroy the old token.
Or at least, it will try to.
Diffstat (limited to 'server.py')
-rwxr-xr-xserver.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/server.py b/server.py
index c665886..b3b1aa6 100755
--- a/server.py
+++ b/server.py
@@ -10,7 +10,7 @@ from websock import WebSocketServer, WebSocket
## Local Modules
from utils import stdout, now, clients, debug
from consts import MAX_CLIENTS, PACKET_ACK
-import protocol, security, traceback
+import protocol, security, player, traceback
###############################################################
# Configuration
@@ -100,7 +100,12 @@ class WebSocketConn(WebSocket):
#for client in clients:
# client.send_message(self.address[0] + u' - disconnected')
stdout(self.address[0] + u' - disconnected')
- # TODO: if self.token != "0": try: player.clear(self.token)
+ if self.token != "0":
+ try:
+ player.clear(self.token)
+ except:
+ traceback.print_exc()
+ stdout("Error at player.clear")
##########################
# Useful functions: