mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
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().
This commit is contained in:
parent
79c93ba47b
commit
fcd58de78f
1 changed files with 3 additions and 1 deletions
|
@ -72,6 +72,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
|
||||||
self._loop.call_soon(self._call_connection_lost, None)
|
self._loop.call_soon(self._call_connection_lost, None)
|
||||||
if self._read_fut is not None:
|
if self._read_fut is not None:
|
||||||
self._read_fut.cancel()
|
self._read_fut.cancel()
|
||||||
|
self._read_fut = None
|
||||||
|
|
||||||
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
|
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
|
||||||
if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
|
if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
|
||||||
|
@ -93,9 +94,10 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin,
|
||||||
self._conn_lost += 1
|
self._conn_lost += 1
|
||||||
if self._write_fut:
|
if self._write_fut:
|
||||||
self._write_fut.cancel()
|
self._write_fut.cancel()
|
||||||
|
self._write_fut = None
|
||||||
if self._read_fut:
|
if self._read_fut:
|
||||||
self._read_fut.cancel()
|
self._read_fut.cancel()
|
||||||
self._write_fut = self._read_fut = None
|
self._read_fut = None
|
||||||
self._pending_write = 0
|
self._pending_write = 0
|
||||||
self._buffer = None
|
self._buffer = None
|
||||||
self._loop.call_soon(self._call_connection_lost, exc)
|
self._loop.call_soon(self._call_connection_lost, exc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue