Check for a closed connection in _add_io_state.

Closes #163.
This commit is contained in:
Ben Darnell 2010-11-04 11:47:34 -07:00
parent c467cf0274
commit 2b44fac4ec
1 changed files with 3 additions and 0 deletions

View File

@ -359,6 +359,9 @@ class IOStream(object):
raise IOError("Stream is closed")
def _add_io_state(self, state):
if socket is None:
# connection has been closed, so there can be no future events
return
if not self._state & state:
self._state = self._state | state
self.io_loop.update_handler(self.socket.fileno(), self._state)