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
1a754877
Commit
1a754877
authored
May 14, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 优化coco
parent
cb161095
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
httpd.py
coco/httpd.py
+0
-0
models.py
coco/models.py
+4
-5
No files found.
coco/httpd.py
View file @
1a754877
This diff is collapsed.
Click to expand it.
coco/models.py
View file @
1a754877
...
...
@@ -218,7 +218,7 @@ class WSProxy:
```
"""
def
__init__
(
self
,
ws
,
child
,
room
,
connection
):
def
__init__
(
self
,
ws
,
child
,
room
_id
):
"""
:param ws: websocket instance or handler, have write_message method
:param child: sock child pair
...
...
@@ -226,9 +226,8 @@ class WSProxy:
self
.
ws
=
ws
self
.
child
=
child
self
.
stop_event
=
threading
.
Event
()
self
.
room
=
room
self
.
room
_id
=
room_id
self
.
auto_forward
()
self
.
connection
=
connection
def
send
(
self
,
msg
):
"""
...
...
@@ -252,7 +251,8 @@ class WSProxy:
if
len
(
data
)
==
0
:
self
.
close
()
data
=
data
.
decode
(
errors
=
"ignore"
)
self
.
ws
.
emit
(
"data"
,
{
'data'
:
data
,
'room'
:
self
.
connection
},
room
=
self
.
room
)
self
.
ws
.
emit
(
"data"
,
{
'data'
:
data
,
'room'
:
self
.
room_id
},
room
=
self
.
room_id
)
if
len
(
data
)
==
BUF_SIZE
:
time
.
sleep
(
0.1
)
...
...
@@ -265,7 +265,6 @@ class WSProxy:
self
.
stop_event
.
set
()
self
.
child
.
shutdown
(
1
)
self
.
child
.
close
()
self
.
ws
.
logout
(
self
.
connection
)
logger
.
debug
(
"Proxy {} closed"
.
format
(
self
))
...
...
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