Skip to content

Commit

Permalink
Fix occasional server disconnect crashes (Fixes #146)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikWin authored and miguelgrinberg committed Nov 17, 2019
1 parent 3c221aa commit 9f96cd8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion engineio/asyncio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ async def disconnect(self, sid=None):
pass
else:
await socket.close()
del self.sockets[sid]
if sid in self.sockets: # pragma: no cover
del self.sockets[sid]
else:
await asyncio.wait([client.close()
for client in six.itervalues(self.sockets)])
Expand Down
3 changes: 2 additions & 1 deletion engineio/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def disconnect(self, sid=None):
pass
else:
socket.close()
del self.sockets[sid]
if sid in self.sockets: # pragma: no cover
del self.sockets[sid]
else:
for client in six.itervalues(self.sockets):
client.close()
Expand Down

0 comments on commit 9f96cd8

Please sign in to comment.