.BANCHO. .HIDE. General refactoring

This commit is contained in:
Nyo 2016-12-10 19:31:12 +01:00
parent 8532731f19
commit c4a6c84cec
3 changed files with 4 additions and 7 deletions

View File

@ -17,7 +17,7 @@ def handle(userToken, _=None, deleteToken=True):
# 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):
if int(time.time() - userToken.loginTime) >= 5 or userToken.irc:
# Stop spectating
userToken.stopSpectating()
@ -35,7 +35,7 @@ def handle(userToken, _=None, deleteToken=True):
glob.streams.broadcast("main", serverPackets.userLogout(userID))
# Disconnect from IRC if needed
if userToken.irc == True and glob.irc == True:
if userToken.irc and glob.irc:
glob.ircServer.forceDisconnection(userToken.username)
# Delete token

View File

@ -136,7 +136,7 @@ class Client:
self.server.removeClient(self, quitmsg)
# Bancho logout
if callLogout:
if callLogout and self.banchoUsername != "":
chat.IRCDisconnect(self.IRCUsername)
@ -669,7 +669,7 @@ class Server:
try:
self.clients[conn] = Client(self, conn)
log.info("[IRC] Accepted connection from {}:{}".format(addr[0], addr[1]))
except socket.error as e:
except socket.error:
try:
conn.close()
except:

3
pep.py
View File

@ -1,9 +1,7 @@
"""Hello, pep.py here, ex-owner of ripple and prime minister of Ripwot."""
import os
import sys
import threading
from multiprocessing.pool import ThreadPool
import tornado.gen
import tornado.httpserver
import tornado.ioloop
@ -41,7 +39,6 @@ from pubSubHandlers import banHandler
from pubSubHandlers import updateSilenceHandler
from pubSubHandlers import updateStatsHandler
def make_app():
return tornado.web.Application([
(r"/", mainHandler.handler),