webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 12bac55e51ef38bed130df44eebca0526649f82b
parent 20ba6bad366cd943f48464b3a329fd3d61b8863d
Author: Sheng <webmaster0115@gmail.com>
Date:   Tue,  3 Apr 2018 19:17:59 +0800

Use daemon thread for ssh_connect

Diffstat:
Mmain.py | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/main.py b/main.py @@ -222,7 +222,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): chan = ssh.invoke_shell(term='xterm') chan.setblocking(0) worker = Worker(ssh, chan, dst_addr) - IOLoop.current().call_later(DELAY, recycle, worker) + worker.src_addr = self.get_client_addr() return worker def ssh_connect_wrapped(self, future): @@ -243,18 +243,18 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): status = None future = Future() - threading.Thread( - target=self.ssh_connect_wrapped, args=(future,) - ).start() + t = threading.Thread(target=self.ssh_connect_wrapped, args=(future,)) + t.setDaemon(True) + t.start() try: worker = yield future except Exception as exc: status = str(exc) else: - worker.src_addr = self.get_client_addr() worker_id = worker.id workers[worker_id] = worker + IOLoop.current().call_later(DELAY, recycle, worker) self.write(dict(id=worker_id, status=status))