Skip to content

Commit

Permalink
properly handle disconnects from ios client
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Apr 28, 2019
1 parent ac7fa5c commit c0c1bf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions socketio/asyncio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ async def _handle_disconnect(self, sid, namespace):
if namespace == '/' and self.manager.is_connected(sid, namespace):
await self._trigger_event('disconnect', '/', sid)
self.manager.disconnect(sid, '/')
if sid in self.environ:
del self.environ[sid]

async def _handle_event(self, sid, namespace, id, data):
"""Handle an incoming client event."""
Expand Down Expand Up @@ -505,6 +503,8 @@ async def _handle_eio_message(self, sid, data):
async def _handle_eio_disconnect(self, sid):
"""Handle Engine.IO disconnect event."""
await self._handle_disconnect(sid, '/')
if sid in self.environ:
del self.environ[sid]

def _engineio_server_class(self):
return engineio.AsyncServer
4 changes: 2 additions & 2 deletions socketio/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,6 @@ def _handle_disconnect(self, sid, namespace):
if namespace == '/' and self.manager.is_connected(sid, namespace):
self._trigger_event('disconnect', '/', sid)
self.manager.disconnect(sid, '/')
if sid in self.environ:
del self.environ[sid]

def _handle_event(self, sid, namespace, id, data):
"""Handle an incoming client event."""
Expand Down Expand Up @@ -673,6 +671,8 @@ def _handle_eio_message(self, sid, data):
def _handle_eio_disconnect(self, sid):
"""Handle Engine.IO disconnect event."""
self._handle_disconnect(sid, '/')
if sid in self.environ:
del self.environ[sid]

def _engineio_server_class(self):
return engineio.Server

0 comments on commit c0c1bf8

Please sign in to comment.