From: Ben Darnell Date: Sun, 7 Oct 2012 04:06:52 +0000 (-0700) Subject: Check self.closed() in the inner read loop of IOStream. X-Git-Tag: v3.0.0~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d7520e76858191acc2adf095279ffdbcea0d1cf;p=thirdparty%2Ftornado.git Check self.closed() in the inner read loop of IOStream. This was causing error logs in the keepalive tests (but only on epoll) --- diff --git a/tornado/iostream.py b/tornado/iostream.py index 23457d9f0..34fa9ed37 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -330,7 +330,7 @@ class BaseIOStream(object): # clause below (which calls `close` and does need to # trigger the callback) self._pending_callbacks += 1 - while True: + while not self.closed(): # Read from the socket until we get EWOULDBLOCK or equivalent. # SSL sockets do some internal buffering, and if the data is # sitting in the SSL object's buffer select() and friends @@ -367,10 +367,9 @@ class BaseIOStream(object): try: # See comments in _handle_read about incrementing _pending_callbacks self._pending_callbacks += 1 - while True: + while not self.closed(): if self._read_to_buffer() == 0: break - self._check_closed() finally: self._pending_callbacks -= 1 if self._read_from_buffer():