From: Florian Diebold Date: Sun, 4 Sep 2011 16:47:01 +0000 (+0200) Subject: Fix the IOStream close callback not getting called if there are pending callbacks. X-Git-Tag: v2.1.0~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e811959588389e374caf60270f86b37dce94c889;p=thirdparty%2Ftornado.git Fix the IOStream close callback not getting called if there are pending callbacks. _maybe_add_error_listener only does anything if _state is None. --- diff --git a/tornado/iostream.py b/tornado/iostream.py index 5869ec8c0..122614a69 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -224,6 +224,7 @@ class IOStream(object): self._consume(self._read_buffer_size)) if self._state is not None: self.io_loop.remove_handler(self.socket.fileno()) + self._state = None self.socket.close() self.socket = None if self._close_callback and self._pending_callbacks == 0: