]> granicus.if.org Git - python/commitdiff
asyncio: Fix _ProactorBasePipeTransport.close()
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 12:40:27 +0000 (13:40 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 15 Jan 2015 12:40:27 +0000 (13:40 +0100)
Set the _read_fut attribute to None after cancelling it.

This change should fix a race condition with
_ProactorWritePipeTransport._pipe_closed().

Lib/asyncio/proactor_events.py

index a177d32af6ed6df0a10fc6d3bd60917270e59681..6d8641feee5819f2c0bbe4a993fd76f1fab39bfd 100644 (file)
@@ -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)