mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
bpo-37279: Fix asyncio sendfile support when extra data are sent in fallback mode. (GH-14075)
(cherry picked from commit ef2152354f
)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
This commit is contained in:
parent
3fde750cc4
commit
bb07321c6a
3 changed files with 6 additions and 3 deletions
|
@ -861,7 +861,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
read = await self.run_in_executor(None, file.readinto, view)
|
||||
if not read:
|
||||
break # EOF
|
||||
await self.sock_sendall(sock, view)
|
||||
await self.sock_sendall(sock, view[:read])
|
||||
total_sent += read
|
||||
return total_sent
|
||||
finally:
|
||||
|
@ -1145,7 +1145,7 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
if not read:
|
||||
return total_sent # EOF
|
||||
await proto.drain()
|
||||
transp.write(view)
|
||||
transp.write(view[:read])
|
||||
total_sent += read
|
||||
finally:
|
||||
if total_sent > 0 and hasattr(file, 'seek'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue