[Python-checkins] cpython: asyncio: When not closing the connection after receiving EOF, still remove the

guido.van.rossum python-checkins at python.org
Wed Oct 30 22:53:01 CET 2013


http://hg.python.org/cpython/rev/14069b168246
changeset:   86785:14069b168246
user:        Guido van Rossum <guido at dropbox.com>
date:        Wed Oct 30 14:36:58 2013 -0700
summary:
  asyncio: When not closing the connection after receiving EOF, still remove the read handler.

files:
  Lib/asyncio/selector_events.py |  7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py
--- a/Lib/asyncio/selector_events.py
+++ b/Lib/asyncio/selector_events.py
@@ -468,7 +468,12 @@
                 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):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list