diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-15 12:40:27 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-15 12:40:27 (GMT) |
commit | fcd58de78f72ca114707b78e448397d6dbe2ad5d (patch) | |
tree | e97ebde79b733878aa77039018b339e6c4fc74ed /Lib | |
parent | 79c93ba47b1bd638989c60726eb6d9467c47308c (diff) | |
download | cpython-fcd58de78f72ca114707b78e448397d6dbe2ad5d.zip cpython-fcd58de78f72ca114707b78e448397d6dbe2ad5d.tar.gz cpython-fcd58de78f72ca114707b78e448397d6dbe2ad5d.tar.bz2 |
asyncio: Fix _ProactorBasePipeTransport.close()
Set the _read_fut attribute to None after cancelling it.
This change should fix a race condition with
_ProactorWritePipeTransport._pipe_closed().
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncio/proactor_events.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index a177d32..6d8641f 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -72,6 +72,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, self._loop.call_soon(self._call_connection_lost, None) if self._read_fut is not None: self._read_fut.cancel() + self._read_fut = None def _fatal_error(self, exc, message='Fatal error on pipe transport'): if isinstance(exc, (BrokenPipeError, ConnectionResetError)): @@ -93,9 +94,10 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, self._conn_lost += 1 if self._write_fut: self._write_fut.cancel() + self._write_fut = None if self._read_fut: self._read_fut.cancel() - self._write_fut = self._read_fut = None + self._read_fut = None self._pending_write = 0 self._buffer = None self._loop.call_soon(self._call_connection_lost, exc) |