summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--player.py8
-rwxr-xr-xserver.py9
2 files changed, 15 insertions, 2 deletions
diff --git a/player.py b/player.py
index fea3b16..74b7e23 100644
--- a/player.py
+++ b/player.py
@@ -176,6 +176,13 @@ def clear(token, mask=SQL_CLEAR):
# This function saves and clears a token
#########################################
try:
+ stdout("Saving user ID %d" % Player[token]["userid"])
+ except:
+ stdout("ERROR: Token \"%s\" is not valid." % token)
+ return
+
+ #########################################
+ try:
# Save inventory data to SQL
sql.save_inv(token, mask)
@@ -404,6 +411,7 @@ def get_data(args, token):
# If they are, cause a disconnection on old one and update tokens
try:
org_usr=cli_search(target_uid["userid"])
+ stdout("Cli Search Result: %r" % repr(org_user))
tk="0"
if org_usr not in ["ERROR"]:
stdout("Closing duplicate login from %s (token %s)" % (org_user.address[0], org_user.token))
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: