diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-01-27 19:22:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-27 19:22:47 (GMT) |
commit | 7c684073f951dd891021676ecfd86ffc18b8895e (patch) | |
tree | b19f8254e8c3f3ac516b922eda7b985edbfebf70 /Lib/asyncio/proactor_events.py | |
parent | f13f12d8daa587b5fcc66fe3ed1090a5dadab289 (diff) | |
download | cpython-7c684073f951dd891021676ecfd86ffc18b8895e.zip cpython-7c684073f951dd891021676ecfd86ffc18b8895e.tar.gz cpython-7c684073f951dd891021676ecfd86ffc18b8895e.tar.bz2 |
bpo-32622: Implement loop.sendfile() (#5271)
Diffstat (limited to 'Lib/asyncio/proactor_events.py')
-rw-r--r-- | Lib/asyncio/proactor_events.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index ab1285b..6d27e53 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -180,7 +180,12 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, assert self._read_fut is fut or (self._read_fut is None and self._closing) self._read_fut = None - data = fut.result() # deliver data later in "finally" clause + if fut.done(): + # deliver data later in "finally" clause + data = fut.result() + else: + # the future will be replaced by next proactor.recv call + fut.cancel() if self._closing: # since close() has been called we ignore any read data @@ -345,6 +350,8 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, transports.Transport): """Transport for connected sockets.""" + _sendfile_compatible = constants._SendfileMode.FALLBACK + def _set_extra(self, sock): self._extra['socket'] = sock |