Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f683bb

Browse files
author
Guido van Rossum
committed
asyncio: When not closing the connection after receiving EOF, still remove the read handler.
1 parent 4574b49 commit 1f683bb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/asyncio/selector_events.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,12 @@ def _read_ready(self):
468468
self._protocol.data_received(data)
469469
else:
470470
keep_open = self._protocol.eof_received()
471-
if not keep_open:
471+
if keep_open:
472+
# We're keeping the connection open so the
473+
# protocol can write more, but we still can't
474+
# receive more, so remove the reader callback.
475+
self._loop.remove_reader(self._sock_fd)
476+
else:
472477
self.close()
473478

474479
def write(self, data):

0 commit comments

Comments
 (0)