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
d2b59e37
Commit
d2b59e37
authored
May 22, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复边遍历connections边更改的bug
parent
d4e027d7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
app.py
coco/app.py
+7
-2
httpd.py
coco/httpd.py
+2
-2
models.py
coco/models.py
+1
-4
No files found.
coco/app.py
View file @
d2b59e37
...
@@ -170,12 +170,17 @@ class Coco:
...
@@ -170,12 +170,17 @@ class Coco:
active_sessions
=
[
str
(
session
.
id
)
for
session
in
self
.
sessions
]
active_sessions
=
[
str
(
session
.
id
)
for
session
in
self
.
sessions
]
for
filename
in
os
.
listdir
(
log_dir
):
for
filename
in
os
.
listdir
(
log_dir
):
session_id
=
filename
.
split
(
'.'
)[
0
]
session_id
=
filename
.
split
(
'.'
)[
0
]
full_path
=
os
.
path
.
join
(
log_dir
,
filename
)
if
len
(
session_id
)
!=
36
:
if
len
(
session_id
)
!=
36
:
continue
continue
if
session_id
not
in
active_sessions
:
if
session_id
not
in
active_sessions
:
recorder
.
file_path
=
os
.
path
.
join
(
log_dir
,
filename
)
recorder
.
file_path
=
full_path
recorder
.
upload_replay
(
session_id
,
1
)
ok
=
recorder
.
upload_replay
(
session_id
,
1
)
if
not
ok
and
os
.
path
.
getsize
(
full_path
)
==
0
:
os
.
unlink
(
full_path
)
time
.
sleep
(
interval
)
time
.
sleep
(
interval
)
thread
=
threading
.
Thread
(
target
=
func
)
thread
=
threading
.
Thread
(
target
=
func
)
thread
.
start
()
thread
.
start
()
...
...
coco/httpd.py
View file @
d2b59e37
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
import
os
import
os
import
socket
import
socket
import
uuid
import
uuid
from
copy
import
deepcopy
from
flask_socketio
import
SocketIO
,
Namespace
,
join_room
from
flask_socketio
import
SocketIO
,
Namespace
,
join_room
from
flask
import
Flask
,
request
,
current_app
,
redirect
from
flask
import
Flask
,
request
,
current_app
,
redirect
...
@@ -212,7 +211,8 @@ class ProxyNamespace(BaseNamespace):
...
@@ -212,7 +211,8 @@ class ProxyNamespace(BaseNamespace):
def
on_disconnect
(
self
):
def
on_disconnect
(
self
):
logger
.
debug
(
"On disconnect event trigger"
)
logger
.
debug
(
"On disconnect event trigger"
)
for
room_id
in
self
.
connections
.
get
(
request
.
sid
,
{}):
rooms
=
{
k
:
v
for
k
,
v
in
self
.
connections
.
get
(
request
.
sid
,
{})
.
items
()}
for
room_id
in
rooms
:
try
:
try
:
self
.
on_logout
(
room_id
)
self
.
on_logout
(
room_id
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
coco/models.py
View file @
d2b59e37
...
@@ -252,7 +252,7 @@ class WSProxy:
...
@@ -252,7 +252,7 @@ class WSProxy:
except
(
OSError
,
EOFError
):
except
(
OSError
,
EOFError
):
self
.
close
()
self
.
close
()
break
break
if
len
(
data
)
==
0
:
if
not
data
:
self
.
close
()
self
.
close
()
break
break
data
=
data
.
decode
(
errors
=
"ignore"
)
data
=
data
.
decode
(
errors
=
"ignore"
)
...
@@ -276,6 +276,3 @@ class WSProxy:
...
@@ -276,6 +276,3 @@ class WSProxy:
pass
pass
logger
.
debug
(
"Proxy {} closed"
.
format
(
self
))
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