aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingtong Li <runassudo@yingtongli.me>2017-03-28 22:19:44 +1100
committerYingtong Li <runassudo@yingtongli.me>2017-03-28 22:19:44 +1100
commita3e7b6e63df997145ec12e020968d094247c4520 (patch)
tree0108e889e6cd70d4bba843eaaacd628b86210989
parentf10543a90203cb13fef53c3d0ef26590925d0be8 (diff)
Fix failure to update sidebar on client disconnect
-rw-r--r--pblive/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pblive/__init__.py b/pblive/__init__.py
index 149a71d..423ec7a 100644
--- a/pblive/__init__.py
+++ b/pblive/__init__.py
@@ -117,6 +117,10 @@ def socket_disconnect():
if flask.request.sid in data.users:
user = data.users[flask.request.sid]
+ data.users_lock.acquire()
+ del data.users[flask.request.sid]
+ data.users_lock.release()
+
# Release the colour if it's being held
if user.colour:
user.session.colours.append(user.colour)
@@ -130,10 +134,6 @@ def socket_disconnect():
for _, admin in data.iterate_admins():
if admin.session == user.session:
flask_socketio.emit('update_left', render_sidebar(admin, user.session), room=admin.sid)
-
- data.users_lock.acquire()
- del data.users[flask.request.sid]
- data.users_lock.release()
@socketio.on('register')
def socket_register(colour_id, colour_name):
Contact (issues, pull requests, etc.) at git@yingtongli.me. Generated by cgit.