Message329388
> In that case I think asyncio's sendfile() should simply do the math to transmit that many bytes by taking into account that os.sendfile() may return less bytes than requested.
The internal sendfile() implementation in asyncio already loops until all bytes are sent. Extract of unix_events.py:
def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
offset, count, blocksize, total_sent):
...
try:
sent = os.sendfile(fd, fileno, offset, blocksize)
except (BlockingIOError, InterruptedError):
...
else:
if sent == 0:
# EOF
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
fut.set_result(total_sent)
else:
offset += sent
total_sent += sent
self.add_writer(fd, self._sock_sendfile_native_impl, fut, ...)
asyncio doesn't need to be modified. |
|
Date |
User |
Action |
Args |
2018-11-06 21:35:06 | vstinner | set | recipients:
+ vstinner, giampaolo.rodola, asvetlov, yselivanov |
2018-11-06 21:35:06 | vstinner | set | messageid: <1541540106.6.0.788709270274.issue35179@psf.upfronthosting.co.za> |
2018-11-06 21:35:06 | vstinner | link | issue35179 messages |
2018-11-06 21:35:06 | vstinner | create | |
|