diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-12-21 12:23:53 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-12-21 12:23:53 -0300 |
commit | 6dfad60debdbf1abd24d7acd4c5cd3e091f2f789 (patch) | |
tree | a1f90eea899a568a6c5085f0392b4d949ee9ca8b | |
parent | 08587596d01dd1456f9000258d01878a7c3780d0 (diff) | |
download | server-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.py | 9 | ||||
-rwxr-xr-x | server.py | 2 |
2 files changed, 7 insertions, 4 deletions
@@ -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 @@ -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: |