Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ef215235
Commit
ef215235
authored
Jun 15, 2019
by
Andrew Svetlov
Committed by
GitHub
Jun 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37279: Fix asyncio sendfile support when extra data are sent in fallback mode. (GH-14075)
parent
7efc526e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
Lib/asyncio/base_events.py
Lib/asyncio/base_events.py
+2
-2
Lib/test/test_asyncio/test_sendfile.py
Lib/test/test_asyncio/test_sendfile.py
+2
-1
Misc/NEWS.d/next/Library/2019-06-14-13-25-56.bpo-37279.OHlW6l.rst
...S.d/next/Library/2019-06-14-13-25-56.bpo-37279.OHlW6l.rst
+2
-0
No files found.
Lib/asyncio/base_events.py
View file @
ef215235
...
...
@@ -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'
):
...
...
Lib/test/test_asyncio/test_sendfile.py
View file @
ef215235
...
...
@@ -86,7 +86,8 @@ class MyProto(asyncio.Protocol):
class
SendfileBase
:
DATA
=
b"SendfileBaseData"
*
(
1024
*
8
)
# 128 KiB
# 128 KiB plus small unaligned to buffer chunk
DATA
=
b"SendfileBaseData"
*
(
1024
*
8
+
1
)
# Reduce socket buffer size to test on relative small data sets.
BUF_SIZE
=
4
*
1024
# 4 KiB
...
...
Misc/NEWS.d/next/Library/2019-06-14-13-25-56.bpo-37279.OHlW6l.rst
0 → 100644
View file @
ef215235
Fix asyncio sendfile support when sendfile sends extra data in fallback
mode.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment