Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor sendfile #3383

Merged
merged 18 commits into from
Nov 8, 2018
Prev Previous commit
Next Next commit
Fix functools.partial call
  • Loading branch information
asvetlov committed Nov 7, 2018
commit 644a7fed0db7c29308fb6d312f6d2fd785874eed
4 changes: 2 additions & 2 deletions aiohttp/web_fileresponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _do_sendfile(self, out_fd: int) -> bool:
assert self._count >= 0
return self._count == 0

def _done_fut(self, fut: 'asyncio.Future[None]', out_fd: int) -> None:
def _done_fut(self, out_fd: int, fut: 'asyncio.Future[None]') -> None:
self.loop.remove_writer(out_fd)

async def sendfile(self) -> None:
Expand All @@ -93,7 +93,7 @@ async def sendfile(self) -> None:
await loop.sock_sendall(out_socket, data)
if not self._do_sendfile(out_fd):
fut = loop.create_future()
fut.add_done_callback(partial(self._done_fut, out_fd))
fut.add_done_callback(partial(out_fd))
loop.add_writer(out_fd, self._sendfile_cb, fut, out_fd)
await fut
except asyncio.CancelledError:
Expand Down