Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
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
ops
coco
Commits
34de75cb
Commit
34de75cb
authored
Dec 24, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改eventlet
parent
6e153a1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
10 deletions
+17
-10
app.py
coco/httpd/app.py
+5
-2
interactive.py
coco/interactive.py
+2
-2
sshd.py
coco/sshd.py
+1
-1
cocod
cocod
+9
-5
No files found.
coco/httpd/app.py
View file @
34de75cb
# -*- coding: utf-8 -*-
#
import
os
from
flask_socketio
import
SocketIO
from
flask
import
Flask
...
...
@@ -17,8 +18,10 @@ socket_io = SocketIO()
socket_io
.
on_namespace
(
ProxyNamespace
(
'/ssh'
))
socket_io
.
on_namespace
(
ElfinderNamespace
(
'/elfinder'
))
# init_kwargs = {'async_mode': 'threading'}
init_kwargs
=
{
'async_mode'
:
'eventlet'
}
if
os
.
environ
.
get
(
'USE_EVENTLET'
,
'1'
)
==
'1'
:
init_kwargs
=
{
'async_mode'
:
'eventlet'
}
else
:
init_kwargs
=
{
'async_mode'
:
'threading'
}
socket_io
.
init_app
(
app
,
**
init_kwargs
),
socket_io
.
on_error_default
(
lambda
x
:
logger
.
exception
(
x
))
...
...
coco/interactive.py
View file @
34de75cb
...
...
@@ -304,8 +304,8 @@ class InteractiveServer:
)
def
display_page_bottom_prompt
(
self
):
msg
=
wr
(
_
(
'Tips: Enter the asset ID and log directly into the asset.'
))
self
.
client
.
send
(
msg
,
before
=
1
)
msg
=
wr
(
_
(
'Tips: Enter the asset ID and log directly into the asset.'
)
,
before
=
1
)
self
.
client
.
send
(
msg
)
prompt_page_up
=
_
(
"Page up: P/p"
)
prompt_page_down
=
_
(
"Page down: Enter|N/n"
)
prompt_back
=
_
(
"BACK: b/q"
)
...
...
coco/sshd.py
View file @
34de75cb
...
...
@@ -92,7 +92,7 @@ class SSHServer:
t
.
daemon
=
True
t
.
start
()
transport
.
close
()
except
paramiko
.
SSHException
:
except
(
paramiko
.
SSHException
,
sock
.
timeout
)
:
logger
.
warning
(
"SSH negotiation failed"
)
except
EOFError
as
e
:
logger
.
warning
(
"Handle EOF Error: {}"
.
format
(
e
))
...
...
cocod
View file @
34de75cb
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import
os
#import eventlet
#from eventlet.debug import hub_prevent_multiple_readers
#eventlet.monkey_patch()
#hub_prevent_multiple_readers(False)
if
os
.
environ
.
get
(
'USE_EVENTLET'
,
'1'
)
==
'1'
:
import
eventlet
from
eventlet.debug
import
hub_prevent_multiple_readers
eventlet
.
monkey_patch
()
hub_prevent_multiple_readers
(
False
)
print
(
"Use eventlet dispatch"
)
else
:
print
(
"Use local threading"
)
import
os
import
sys
import
argparse
import
time
...
...
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