.BANCHO. Revert ".BANCHO. Switched to tornado+gevent"
This commit is contained in:
parent
31a78432bb
commit
255a0958ff
|
@ -11,7 +11,6 @@ This is Ripple's bancho server. It handles:
|
|||
- Python 3.5
|
||||
- MySQLdb (`mysqlclient`)
|
||||
- Tornado
|
||||
- Gevent
|
||||
- Bcrypt
|
||||
- Raven
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class config:
|
|||
self.config.get("db","workers")
|
||||
|
||||
self.config.get("server","port")
|
||||
self.config.get("server","threads")
|
||||
self.config.get("server","gzip")
|
||||
self.config.get("server","gziplevel")
|
||||
self.config.get("server","cikey")
|
||||
|
@ -82,6 +83,7 @@ class config:
|
|||
|
||||
self.config.add_section("server")
|
||||
self.config.set("server", "port", "5001")
|
||||
self.config.set("server", "threads", "16")
|
||||
self.config.set("server", "gzip", "1")
|
||||
self.config.set("server", "gziplevel", "6")
|
||||
self.config.set("server", "cikey", "changeme")
|
||||
|
|
|
@ -3,7 +3,6 @@ import tornado.web
|
|||
import tornado.gen
|
||||
from tornado.ioloop import IOLoop
|
||||
from objects import glob
|
||||
import gevent
|
||||
|
||||
class asyncRequestHandler(tornado.web.RequestHandler):
|
||||
"""
|
||||
|
@ -56,9 +55,7 @@ def runBackground(data, callback):
|
|||
func, args, kwargs = data
|
||||
def _callback(result):
|
||||
IOLoop.instance().add_callback(lambda: callback(result))
|
||||
g = gevent.Greenlet(func, *args, **kwargs)
|
||||
g.link(_callback)
|
||||
g.start()
|
||||
glob.pool.apply_async(func, args, kwargs, _callback)
|
||||
|
||||
def checkArguments(arguments, requiredArguments):
|
||||
"""
|
||||
|
|
|
@ -28,6 +28,7 @@ verifiedCache = {}
|
|||
cloudflare = False
|
||||
chatFilters = None
|
||||
userIDCache = {}
|
||||
pool = None
|
||||
|
||||
debug = False
|
||||
outputRequestTime = False
|
||||
|
|
13
pep.py
13
pep.py
|
@ -7,9 +7,7 @@ import tornado.gen
|
|||
import tornado.httpserver
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
from gevent import monkey as brit_monkey
|
||||
|
||||
brit_monkey.patch_all()
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
||||
# Raven
|
||||
from raven.contrib.tornado import AsyncSentryClient
|
||||
|
@ -109,6 +107,15 @@ if __name__ == "__main__":
|
|||
glob.tokens.deleteBanchoSessions()
|
||||
consoleHelper.printDone()
|
||||
|
||||
# Create threads pool
|
||||
try:
|
||||
consoleHelper.printNoNl("> Creating threads pool... ")
|
||||
glob.pool = ThreadPool(int(glob.conf.config["server"]["threads"]))
|
||||
consoleHelper.printDone()
|
||||
except:
|
||||
consoleHelper.printError()
|
||||
consoleHelper.printColored("[!] Error while creating threads pool. Please check your config.ini and run the server again", bcolors.RED)
|
||||
|
||||
try:
|
||||
consoleHelper.printNoNl("> Loading chat filters... ")
|
||||
glob.chatFilters = chatFilters.chatFilters()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
requests
|
||||
tornado
|
||||
gevent
|
||||
mysqlclient
|
||||
psutil
|
||||
raven
|
||||
|
|
Loading…
Reference in New Issue
Block a user