.HIDE. Add a bunch of <font>s
This commit is contained in:
parent
feee262ed1
commit
6c85995e53
|
@ -50,7 +50,6 @@ import traceback
|
|||
|
||||
class handler(requestHelper.asyncRequestHandler):
|
||||
def asyncPost(self):
|
||||
glob.meme.acquire()
|
||||
try:
|
||||
# Track time if needed
|
||||
if glob.requestTime == True:
|
||||
|
@ -69,6 +68,7 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
# No token, first request. Handle login.
|
||||
responseTokenString, responseData = loginEvent.handle(self)
|
||||
else:
|
||||
userToken = None # default value
|
||||
try:
|
||||
# This is not the first packet, send response based on client's request
|
||||
# Packet start position, used to read stacked packets
|
||||
|
@ -78,8 +78,10 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
if requestTokenString not in glob.tokens.tokens:
|
||||
raise exceptions.tokenNotFoundException()
|
||||
|
||||
# Token exists, get its object
|
||||
# Token exists, get its object and lock it
|
||||
userToken = glob.tokens.tokens[requestTokenString]
|
||||
userToken.lock.acquire()
|
||||
consoleHelper.printColored("[{}] locked".format(userToken.token), bcolors.YELLOW)
|
||||
|
||||
# Keep reading packets until everything has been read
|
||||
while pos < len(requestData):
|
||||
|
@ -166,6 +168,11 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
responseData += serverPackets.notification("Whoops! Something went wrong, please login again.")
|
||||
consoleHelper.printColored("[!] Received packet from unknown token ({}).".format(requestTokenString), bcolors.RED)
|
||||
consoleHelper.printColored("> {} have been disconnected (invalid token)".format(requestTokenString), bcolors.YELLOW)
|
||||
finally:
|
||||
# Unlock token
|
||||
if userToken != None:
|
||||
consoleHelper.printColored("[{}] unlocked".format(userToken.token), bcolors.GREEN)
|
||||
userToken.lock.release()
|
||||
|
||||
if glob.requestTime == True:
|
||||
# End time
|
||||
|
@ -192,7 +199,6 @@ class handler(requestHelper.asyncRequestHandler):
|
|||
discordBotHelper.sendConfidential(msg)
|
||||
finally:
|
||||
self.finish()
|
||||
glob.meme.release()
|
||||
|
||||
def asyncGet(self):
|
||||
html = "<html><head><title>MA MAURO ESISTE?</title><style type='text/css'>body{width:30%}</style></head><body><pre>"
|
||||
|
|
|
@ -5,7 +5,7 @@ from objects import channelList
|
|||
from objects import matchList
|
||||
import threading
|
||||
|
||||
VERSION = "0.9"
|
||||
VERSION = "1.2"
|
||||
|
||||
db = None
|
||||
conf = None
|
||||
|
@ -17,4 +17,3 @@ memes = True
|
|||
restarting = False
|
||||
pool = None
|
||||
requestTime = False
|
||||
meme = threading.Lock()
|
||||
|
|
|
@ -7,6 +7,7 @@ from helpers import consoleHelper
|
|||
from constants import bcolors
|
||||
from constants import serverPackets
|
||||
from events import logoutEvent
|
||||
import threading
|
||||
|
||||
class token:
|
||||
"""Osu Token object
|
||||
|
@ -75,6 +76,7 @@ class token:
|
|||
self.rank = userHelper.getRankPrivileges(self.userID)
|
||||
self.loginTime = int(time.time())
|
||||
self.pingTime = self.loginTime
|
||||
self.lock = threading.Lock() # <-- Sync primitive
|
||||
|
||||
# Default variables
|
||||
self.spectators = []
|
||||
|
|
2
pep.py
2
pep.py
|
@ -184,7 +184,7 @@ if __name__ == "__main__":
|
|||
glob.requestTime = generalFunctions.stringToBool(glob.conf.config["server"]["outputrequesttime"])
|
||||
|
||||
# Server start message and console output
|
||||
discordBotHelper.sendConfidential("w00t p00t! (pep.py started)")
|
||||
discordBotHelper.sendConfidential("**asyncppytornadovroom** Server started!")
|
||||
consoleHelper.printColored("> Tornado listening for clients on 127.0.0.1:{}...".format(serverPort), bcolors.GREEN)
|
||||
|
||||
# Start tornado
|
||||
|
|
Loading…
Reference in New Issue
Block a user