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

View File

@ -136,7 +136,7 @@ class Client:
self.server.removeClient(self, quitmsg) self.server.removeClient(self, quitmsg)
# Bancho logout # Bancho logout
if callLogout: if callLogout and self.banchoUsername != "":
chat.IRCDisconnect(self.IRCUsername) chat.IRCDisconnect(self.IRCUsername)
@ -669,7 +669,7 @@ class Server:
try: try:
self.clients[conn] = Client(self, conn) self.clients[conn] = Client(self, conn)
log.info("[IRC] Accepted connection from {}:{}".format(addr[0], addr[1])) log.info("[IRC] Accepted connection from {}:{}".format(addr[0], addr[1]))
except socket.error as e: except socket.error:
try: try:
conn.close() conn.close()
except: 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 os
import sys import sys
import threading import threading
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
import tornado.gen import tornado.gen
import tornado.httpserver import tornado.httpserver
import tornado.ioloop import tornado.ioloop
@ -41,7 +39,6 @@ from pubSubHandlers import banHandler
from pubSubHandlers import updateSilenceHandler from pubSubHandlers import updateSilenceHandler
from pubSubHandlers import updateStatsHandler from pubSubHandlers import updateStatsHandler
def make_app(): def make_app():
return tornado.web.Application([ return tornado.web.Application([
(r"/", mainHandler.handler), (r"/", mainHandler.handler),