Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webssh
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑天保
webssh
Commits
12bac55e
Commit
12bac55e
authored
Apr 03, 2018
by
Sheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use daemon thread for ssh_connect
parent
20ba6bad
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
main.py
main.py
+5
-5
No files found.
main.py
View file @
12bac55e
...
@@ -222,7 +222,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -222,7 +222,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
chan
=
ssh
.
invoke_shell
(
term
=
'xterm'
)
chan
=
ssh
.
invoke_shell
(
term
=
'xterm'
)
chan
.
setblocking
(
0
)
chan
.
setblocking
(
0
)
worker
=
Worker
(
ssh
,
chan
,
dst_addr
)
worker
=
Worker
(
ssh
,
chan
,
dst_addr
)
IOLoop
.
current
()
.
call_later
(
DELAY
,
recycle
,
worker
)
worker
.
src_addr
=
self
.
get_client_addr
(
)
return
worker
return
worker
def
ssh_connect_wrapped
(
self
,
future
):
def
ssh_connect_wrapped
(
self
,
future
):
...
@@ -243,18 +243,18 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
...
@@ -243,18 +243,18 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
status
=
None
status
=
None
future
=
Future
()
future
=
Future
()
t
hreading
.
Thread
(
t
=
threading
.
Thread
(
target
=
self
.
ssh_connect_wrapped
,
args
=
(
future
,))
target
=
self
.
ssh_connect_wrapped
,
args
=
(
future
,
)
t
.
setDaemon
(
True
)
)
.
start
()
t
.
start
()
try
:
try
:
worker
=
yield
future
worker
=
yield
future
except
Exception
as
exc
:
except
Exception
as
exc
:
status
=
str
(
exc
)
status
=
str
(
exc
)
else
:
else
:
worker
.
src_addr
=
self
.
get_client_addr
()
worker_id
=
worker
.
id
worker_id
=
worker
.
id
workers
[
worker_id
]
=
worker
workers
[
worker_id
]
=
worker
IOLoop
.
current
()
.
call_later
(
DELAY
,
recycle
,
worker
)
self
.
write
(
dict
(
id
=
worker_id
,
status
=
status
))
self
.
write
(
dict
(
id
=
worker_id
,
status
=
status
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment