summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-21 12:23:53 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-21 12:23:53 -0300
commit6dfad60debdbf1abd24d7acd4c5cd3e091f2f789 (patch)
treea1f90eea899a568a6c5085f0392b4d949ee9ca8b
parent08587596d01dd1456f9000258d01878a7c3780d0 (diff)
downloadserver-6dfad60debdbf1abd24d7acd4c5cd3e091f2f789.tar.gz
server-6dfad60debdbf1abd24d7acd4c5cd3e091f2f789.tar.bz2
server-6dfad60debdbf1abd24d7acd4c5cd3e091f2f789.tar.xz
server-6dfad60debdbf1abd24d7acd4c5cd3e091f2f789.zip
Fix the bug on duplicate login detection
-rw-r--r--player.py9
-rwxr-xr-xserver.py2
2 files changed, 7 insertions, 4 deletions
diff --git a/player.py b/player.py
index 74b7e23..cfbf4b5 100644
--- a/player.py
+++ b/player.py
@@ -410,13 +410,17 @@ def get_data(args, token):
# Check if user is already logged in
# If they are, cause a disconnection on old one and update tokens
try:
+ stdout("=============")
+ stdout("Target UID: %d" % target_uid["userid"])
org_usr=cli_search(target_uid["userid"])
- stdout("Cli Search Result: %r" % repr(org_user))
+ stdout("Cli Search Result: %r" % repr(org_usr))
tk="0"
if org_usr not in ["ERROR"]:
- stdout("Closing duplicate login from %s (token %s)" % (org_user.address[0], org_user.token))
+ stdout("Closing duplicate login from %s (token %s)" % (org_usr.address[0], org_usr.token))
tk=org_usr.token
org_usr.close(status=1000, reason='Duplicated login')
+ else:
+ raise Exception("Not logged in")
# TODO: ApTimer[tk] & Battle[tk]
Player[token]=copy(Player[tk])
@@ -437,6 +441,7 @@ def get_data(args, token):
del Player[token]["token"]
return paydata
except:
+ #traceback.print_exc()
pass
# Create session
diff --git a/server.py b/server.py
index b3b1aa6..b251103 100755
--- a/server.py
+++ b/server.py
@@ -97,8 +97,6 @@ class WebSocketConn(WebSocket):
"""
clients.remove(self)
print(self.address, 'closed')
- #for client in clients:
- # client.send_message(self.address[0] + u' - disconnected')
stdout(self.address[0] + u' - disconnected')
if self.token != "0":
try: