[3.12] gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376) (#131378)

gh-131325: fix sendfile fallback implementation to drain data after writing to transport (GH-131376)
(cherry picked from commit 94f4d87aeb)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
Miss Islington (bot) 2025-03-17 20:40:43 +01:00 committed by GitHub
parent 18e4eb410a
commit c1faeadd82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -1264,8 +1264,8 @@ async def _sendfile_fallback(self, transp, file, offset, count):
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'):

View file

@ -0,0 +1 @@
Fix sendfile fallback implementation to drain data after writing to transport in :mod:`asyncio`.