Skip to content

Commit

Permalink
Avoid KeyError in is_connected.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdoehring committed Mar 7, 2016
1 parent 109c5d7 commit cba6c3e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions socketio/base_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def connect(self, sid, namespace):
self.enter_room(sid, namespace, sid)

def is_connected(self, sid, namespace):
return sid in self.rooms[namespace][None] and \
self.rooms[namespace][None][sid]
try:
return self.rooms[namespace][None][sid]
except KeyError:
pass

def disconnect(self, sid, namespace):
"""Register a client disconnect from a namespace."""
Expand Down

0 comments on commit cba6c3e

Please sign in to comment.