From: Ben Darnell Date: Thu, 4 Nov 2010 18:47:34 +0000 (-0700) Subject: Check for a closed connection in _add_io_state. X-Git-Tag: v1.2.0~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b44fac4ecf273aadc97dbcaa5abf1e3a1ee7dff;p=thirdparty%2Ftornado.git Check for a closed connection in _add_io_state. Closes #163. --- diff --git a/tornado/iostream.py b/tornado/iostream.py index 2897fdc77..4f321d557 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -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)