Browse Source

Fix multi-namespace disconnect logic (Fixes #456)

pull/468/head
Miguel Grinberg 5 years ago
parent
commit
76a9860abc
No known key found for this signature in database GPG Key ID: 36848B262DF5F06C
  1. 4
      socketio/asyncio_server.py
  2. 4
      socketio/server.py

4
socketio/asyncio_server.py

@ -443,11 +443,11 @@ class AsyncServer(server.Server):
namespace_list = [namespace]
for n in namespace_list:
if n != '/' and self.manager.is_connected(sid, n):
self.manager.pre_disconnect(sid, namespace=namespace)
self.manager.pre_disconnect(sid, namespace=n)
await self._trigger_event('disconnect', n, sid)
self.manager.disconnect(sid, n)
if namespace == '/' and self.manager.is_connected(sid, namespace):
self.manager.pre_disconnect(sid, namespace=namespace)
self.manager.pre_disconnect(sid, namespace='/')
await self._trigger_event('disconnect', '/', sid)
self.manager.disconnect(sid, '/')

4
socketio/server.py

@ -652,11 +652,11 @@ class Server(object):
namespace_list = [namespace]
for n in namespace_list:
if n != '/' and self.manager.is_connected(sid, n):
self.manager.pre_disconnect(sid, namespace=namespace)
self.manager.pre_disconnect(sid, namespace=n)
self._trigger_event('disconnect', n, sid)
self.manager.disconnect(sid, n)
if namespace == '/' and self.manager.is_connected(sid, namespace):
self.manager.pre_disconnect(sid, namespace=namespace)
self.manager.pre_disconnect(sid, namespace='/')
self._trigger_event('disconnect', '/', sid)
self.manager.disconnect(sid, '/')

Loading…
Cancel
Save