bpo-32622: Implement loop.sendfile() (#5271)

This commit is contained in:
Andrew Svetlov 2018-01-27 21:22:47 +02:00 committed by GitHub
parent f13f12d8da
commit 7c684073f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 560 additions and 8 deletions

View file

@ -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