-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-32410: Implement loop.sock_sendfile() #4976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
ee13d5b
Draft for sock_sendfile
asvetlov 8b610ad
Add test for blocked socket
asvetlov 8d658be
Polish tests
asvetlov 24c5a28
Test partial file content
asvetlov 10b0b61
Add NEWS entry
asvetlov 5f782a5
Add test for abstract sock_sendfile
asvetlov 3068aa9
Polishment
asvetlov 898766e
Don't call loop.set_debug(True)
asvetlov 6e70a62
Revert set_debug() back
asvetlov 20b3778
Work on tests
asvetlov 7ed0e67
Improve test cleanup
asvetlov f4b61b1
Make tests stable
asvetlov 6f6b94b
Merge remote-tracking branch 'upstream/master' into sock_sendfile
asvetlov 1c05795
Refactor _check_sendfile_params helper
asvetlov f670fad
Use NotImplementedError in private socket.sendfile implementation.
asvetlov 26f6d4a
Refactoring
asvetlov 87d4804
Polish error text
asvetlov 76eeef5
Update docs
asvetlov 35071ea
Fix check for SOCK_STREAM
asvetlov 92ae10b
Accept int fd along with socket instance
asvetlov 8c451d2
Drop support for int FD for socket
asvetlov 921fe69
NotImplementedError -> RuntimeError
asvetlov 0f2a48f
Switch to RuntimeError back
asvetlov 1cc0e8f
Merge branch 'master' into sock_sendfile
asvetlov 272029e
Add sendfile fallback
asvetlov fa0954e
Fix private names
asvetlov 0ddb410
Another renaming
asvetlov c18c3c8
Work on
asvetlov a4a174b
Fix NEWS.d
asvetlov 448e949
More tests
asvetlov 46c92ed
Polish docs
asvetlov 8dd45dc
Revert changes in socket.py
asvetlov c9112b9
Merge branch 'master' into sock_sendfile
asvetlov b6273e4
More tests
asvetlov 4d88063
Tests
asvetlov 71b9f93
Test partial file with fallback
asvetlov db2445e
Improve test coverage
asvetlov 46a6b46
Switch to custom exception type
asvetlov 2ec48f8
read -> readinto
asvetlov 8a6ed3f
Make tests more stable
asvetlov 44da800
Merge remote-tracking branch 'upstream/master' into sock_sendfile
asvetlov 967408e
Change base class for _SendfileNotAvailable to RuntimeError
asvetlov 099dc56
Better exception type when sendfile is not available
asvetlov f9701cb
Add a test for mixed sock_send and sock_sendfile
asvetlov a30acc9
Add cancellation callback
asvetlov f7d9bab
More tests
asvetlov 4d25927
Support tribool for fallback
asvetlov e303db9
Fix signature of abstract sock_sendfile
asvetlov 84e1057
Merge branch 'master' into sock_sendfile
asvetlov 657aa67
Revert back tribool for fallback
asvetlov dd4143a
Fix tests
asvetlov 96d0032
Merge branch 'master' into sock_sendfile
asvetlov 5deb0e2
Add a space
asvetlov 3c9abaf
Fix sock_sendfile callback
asvetlov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You copied this check from other
loop.sock_*
methods, but in fact it's incorrect. It will only handle a case when aFuture
was cancelled right away.The correct way of doing this (and that's btw what I'm doing in uvloop and planned to fix in asyncio) is to register a special callback on
fut
. That callback should check if the future is cancelled, and if it is, cancel the sendfile operation (remove writer).Otherwise, we can't cancel sendfile while
fd
is in selector.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this check?