From 76a9860abc11b5a18fa05e6a8fef815390642d09 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Thu, 9 Apr 2020 23:24:48 +0100 Subject: [PATCH] Fix multi-namespace disconnect logic (Fixes #456) --- socketio/asyncio_server.py | 4 ++-- socketio/server.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/socketio/asyncio_server.py b/socketio/asyncio_server.py index a4c404d..dcb4307 100644 --- a/socketio/asyncio_server.py +++ b/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, '/') diff --git a/socketio/server.py b/socketio/server.py index 7874804..2af55c5 100644 --- a/socketio/server.py +++ b/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, '/')