.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
|
- Python 3.5
|
||||||
- MySQLdb (`mysqlclient`)
|
- MySQLdb (`mysqlclient`)
|
||||||
- Tornado
|
- Tornado
|
||||||
- Gevent
|
|
||||||
- Bcrypt
|
- Bcrypt
|
||||||
- Raven
|
- Raven
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class config:
|
||||||
self.config.get("db","workers")
|
self.config.get("db","workers")
|
||||||
|
|
||||||
self.config.get("server","port")
|
self.config.get("server","port")
|
||||||
|
self.config.get("server","threads")
|
||||||
self.config.get("server","gzip")
|
self.config.get("server","gzip")
|
||||||
self.config.get("server","gziplevel")
|
self.config.get("server","gziplevel")
|
||||||
self.config.get("server","cikey")
|
self.config.get("server","cikey")
|
||||||
|
@ -82,6 +83,7 @@ class config:
|
||||||
|
|
||||||
self.config.add_section("server")
|
self.config.add_section("server")
|
||||||
self.config.set("server", "port", "5001")
|
self.config.set("server", "port", "5001")
|
||||||
|
self.config.set("server", "threads", "16")
|
||||||
self.config.set("server", "gzip", "1")
|
self.config.set("server", "gzip", "1")
|
||||||
self.config.set("server", "gziplevel", "6")
|
self.config.set("server", "gziplevel", "6")
|
||||||
self.config.set("server", "cikey", "changeme")
|
self.config.set("server", "cikey", "changeme")
|
||||||
|
|
|
@ -3,7 +3,6 @@ import tornado.web
|
||||||
import tornado.gen
|
import tornado.gen
|
||||||
from tornado.ioloop import IOLoop
|
from tornado.ioloop import IOLoop
|
||||||
from objects import glob
|
from objects import glob
|
||||||
import gevent
|
|
||||||
|
|
||||||
class asyncRequestHandler(tornado.web.RequestHandler):
|
class asyncRequestHandler(tornado.web.RequestHandler):
|
||||||
"""
|
"""
|
||||||
|
@ -56,9 +55,7 @@ def runBackground(data, callback):
|
||||||
func, args, kwargs = data
|
func, args, kwargs = data
|
||||||
def _callback(result):
|
def _callback(result):
|
||||||
IOLoop.instance().add_callback(lambda: callback(result))
|
IOLoop.instance().add_callback(lambda: callback(result))
|
||||||
g = gevent.Greenlet(func, *args, **kwargs)
|
glob.pool.apply_async(func, args, kwargs, _callback)
|
||||||
g.link(_callback)
|
|
||||||
g.start()
|
|
||||||
|
|
||||||
def checkArguments(arguments, requiredArguments):
|
def checkArguments(arguments, requiredArguments):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -28,6 +28,7 @@ verifiedCache = {}
|
||||||
cloudflare = False
|
cloudflare = False
|
||||||
chatFilters = None
|
chatFilters = None
|
||||||
userIDCache = {}
|
userIDCache = {}
|
||||||
|
pool = None
|
||||||
|
|
||||||
debug = False
|
debug = False
|
||||||
outputRequestTime = False
|
outputRequestTime = False
|
||||||
|
|
13
pep.py
13
pep.py
|
@ -7,9 +7,7 @@ import tornado.gen
|
||||||
import tornado.httpserver
|
import tornado.httpserver
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
import tornado.web
|
import tornado.web
|
||||||
from gevent import monkey as brit_monkey
|
from multiprocessing.pool import ThreadPool
|
||||||
|
|
||||||
brit_monkey.patch_all()
|
|
||||||
|
|
||||||
# Raven
|
# Raven
|
||||||
from raven.contrib.tornado import AsyncSentryClient
|
from raven.contrib.tornado import AsyncSentryClient
|
||||||
|
@ -109,6 +107,15 @@ if __name__ == "__main__":
|
||||||
glob.tokens.deleteBanchoSessions()
|
glob.tokens.deleteBanchoSessions()
|
||||||
consoleHelper.printDone()
|
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:
|
try:
|
||||||
consoleHelper.printNoNl("> Loading chat filters... ")
|
consoleHelper.printNoNl("> Loading chat filters... ")
|
||||||
glob.chatFilters = chatFilters.chatFilters()
|
glob.chatFilters = chatFilters.chatFilters()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
requests
|
requests
|
||||||
tornado
|
tornado
|
||||||
gevent
|
|
||||||
mysqlclient
|
mysqlclient
|
||||||
psutil
|
psutil
|
||||||
raven
|
raven
|
||||||
|
|
Loading…
Reference in New Issue
Block a user