1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

Fixes #4 (remove dependency on Tornado >= 3.1).

This commit is contained in:
grossmj 2014-04-10 19:42:26 -06:00
parent fca399a5ab
commit 8020c2e99c

View File

@ -30,9 +30,12 @@ import signal
import errno import errno
import functools import functools
import socket import socket
import tornado
import tornado.ioloop import tornado.ioloop
import tornado.web import tornado.web
import tornado.autoreload import tornado.autoreload
from pkg_resources import parse_version
from .config import Config from .config import Config
from .handlers.jsonrpc_websocket import JSONRPCWebSocket from .handlers.jsonrpc_websocket import JSONRPCWebSocket
from .handlers.version_handler import VersionHandler from .handlers.version_handler import VersionHandler
@ -136,10 +139,13 @@ class Server(object):
debug=True) # FIXME: debug mode! debug=True) # FIXME: debug mode!
try: try:
print("Starting server on {}:{}".format(self._host, self._port)) print("Starting server on {}:{} (Tornado {})".format(self._host,
tornado_app.listen(self._port, self._port,
address=self._host, tornado.version))
max_buffer_size=524288000) # 500 MB file upload limit kwargs = {"address": self._host}
if parse_version(tornado.version) >= parse_version("3.1"):
kwargs["max_buffer_size"] = 524288000 # 500 MB file upload limit
tornado_app.listen(self._port, **kwargs)
except OSError as e: except OSError as e:
if e.errno == errno.EADDRINUSE: # socket already in use if e.errno == errno.EADDRINUSE: # socket already in use
logging.critical("socket in use for {}:{}".format(self._host, self._port)) logging.critical("socket in use for {}:{}".format(self._host, self._port))