mirror of https://github.com/huashengdun/webssh
Use options.delay instead of DELAY
parent
063b0ee5cf
commit
d54f5b547a
|
@ -23,7 +23,6 @@ except ImportError:
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
|
||||||
|
|
||||||
handler.DELAY = 0.1
|
|
||||||
swallow_http_errors = handler.swallow_http_errors
|
swallow_http_errors = handler.swallow_http_errors
|
||||||
server_encodings = {e.strip() for e in Server.encodings}
|
server_encodings = {e.strip() for e in Server.encodings}
|
||||||
|
|
||||||
|
@ -99,6 +98,7 @@ class TestAppBasic(TestAppBase):
|
||||||
options.hostfile = ''
|
options.hostfile = ''
|
||||||
options.syshostfile = ''
|
options.syshostfile = ''
|
||||||
options.tdstream = ''
|
options.tdstream = ''
|
||||||
|
options.delay = 0.1
|
||||||
app = make_app(make_handlers(loop, options), get_app_settings(options))
|
app = make_app(make_handlers(loop, options), get_app_settings(options))
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ class TestAppBasic(TestAppBase):
|
||||||
|
|
||||||
url = url.replace('http', 'ws')
|
url = url.replace('http', 'ws')
|
||||||
ws_url = url + 'ws?id=' + data['id']
|
ws_url = url + 'ws?id=' + data['id']
|
||||||
yield tornado.gen.sleep(handler.DELAY + 0.1)
|
yield tornado.gen.sleep(options.delay + 0.1)
|
||||||
ws = yield tornado.websocket.websocket_connect(ws_url)
|
ws = yield tornado.websocket.websocket_connect(ws_url)
|
||||||
msg = yield ws.read_message()
|
msg = yield ws.read_message()
|
||||||
self.assertIsNone(msg)
|
self.assertIsNone(msg)
|
||||||
|
|
|
@ -30,7 +30,6 @@ except ImportError:
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
|
||||||
|
|
||||||
DELAY = 3
|
|
||||||
DEFAULT_PORT = 22
|
DEFAULT_PORT = 22
|
||||||
|
|
||||||
swallow_http_errors = True
|
swallow_http_errors = True
|
||||||
|
@ -515,8 +514,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||||
clients[ip] = workers
|
clients[ip] = workers
|
||||||
worker.src_addr = (ip, port)
|
worker.src_addr = (ip, port)
|
||||||
workers[worker.id] = worker
|
workers[worker.id] = worker
|
||||||
self.loop.call_later(options.delay or DELAY, recycle_worker,
|
self.loop.call_later(options.delay, recycle_worker, worker)
|
||||||
worker)
|
|
||||||
self.result.update(id=worker.id, encoding=worker.encoding)
|
self.result.update(id=worker.id, encoding=worker.encoding)
|
||||||
|
|
||||||
self.write(self.result)
|
self.write(self.result)
|
||||||
|
|
|
@ -44,7 +44,7 @@ separated by comma;
|
||||||
'*': wildcard policy, matches any domain, allowed in debug mode only.''')
|
'*': wildcard policy, matches any domain, allowed in debug mode only.''')
|
||||||
define('wpintvl', type=int, default=0, help='Websocket ping interval')
|
define('wpintvl', type=int, default=0, help='Websocket ping interval')
|
||||||
define('timeout', type=int, default=3, help='SSH connection timeout')
|
define('timeout', type=int, default=3, help='SSH connection timeout')
|
||||||
define('delay', type=int, default=0, help='The delay to call recycle_worker')
|
define('delay', type=float, default=3, help='The delay to call recycle_worker')
|
||||||
define('maxconn', type=int, default=20,
|
define('maxconn', type=int, default=20,
|
||||||
help='Maximum live connections (ssh sessions) per client')
|
help='Maximum live connections (ssh sessions) per client')
|
||||||
define('font', default='', help='custom font filename')
|
define('font', default='', help='custom font filename')
|
||||||
|
|
Loading…
Reference in New Issue