.BANCHO. Use tokens while spectating rather than references to clients objects

This commit is contained in:
Nyo
2016-10-07 12:42:02 +02:00
parent ca34583e7b
commit 10e182ce55
5 changed files with 93 additions and 64 deletions

View File

@@ -50,7 +50,9 @@ if userToken.matchID != -1 and userToken.actionID != actions.MULTIPLAYING and us
# Enqueue our new user panel and stats to us and our spectators
recipients = [userToken]
if len(userToken.spectators) > 0:
recipients += userToken.spectators
for i in userToken.spectators:
if i in glob.tokens.tokens:
recipients.append(glob.tokens.tokens[i])
for i in recipients:
if i is not None:

View File

@@ -16,7 +16,7 @@ def handle(userToken, _=None):
# the old logout packet will still be in the queue and will be sent to
# the server, so we accept logout packets sent at least 5 seconds after login
# if the user logs out before 5 seconds, he will be disconnected later with timeout check
if int(time.time()-userToken.loginTime) >= 5 or userToken.irc == True:
if (int(time.time()-userToken.loginTime) >= 5 or userToken.irc) or userToken.tournament:
# Stop spectating
userToken.stopSpectating()