gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376)
(cherry picked from commit
94f4d87aeb4d2d7bddcb4c3aad4f62a727ac91ee)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
read = await self.run_in_executor(None, file.readinto, view)
if not read:
return total_sent # EOF
- await proto.drain()
transp.write(view[:read])
+ await proto.drain()
total_sent += read
finally:
if total_sent > 0 and hasattr(file, 'seek'):
--- /dev/null
+Fix sendfile fallback implementation to drain data after writing to transport in :mod:`asyncio`.