]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
asyncio: When not closing the connection after receiving EOF, still remove the read...
authorGuido van Rossum <guido@dropbox.com>
Wed, 30 Oct 2013 21:36:58 +0000 (14:36 -0700)
committerGuido van Rossum <guido@dropbox.com>
Wed, 30 Oct 2013 21:36:58 +0000 (14:36 -0700)
Lib/asyncio/selector_events.py

index 6cffdd4e35403c50366c98ad01f5a6b4e9ba0db1..c296dccb2d342bcddced7b945a63e7dd313a5248 100644 (file)
@@ -468,7 +468,12 @@ class _SelectorSocketTransport(_SelectorTransport):
                 self._protocol.data_received(data)
             else:
                 keep_open = self._protocol.eof_received()
-                if not keep_open:
+                if keep_open:
+                    # We're keeping the connection open so the
+                    # protocol can write more, but we still can't
+                    # receive more, so remove the reader callback.
+                    self._loop.remove_reader(self._sock_fd)
+                else:
                     self.close()
 
     def write(self, data):