- Notifications
You must be signed in to change notification settings - Fork8.2k
extmod/modlwip,esp32,unix: Add support for socket recv flags argument#17312
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
projectgus wants to merge6 commits intomicropython:masterChoose a base branch fromprojectgus:feature/socket_recv_peek
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Conversation
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
Implements MSG_PEEK and MSG_DONTWAIT.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implements MSG_PEEK and MSG_DONTWAIT (both passed through to LWIPsockets API).This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Adds TCP and UDP multi_net test cases.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>Signed-off-by: Angus Gratton <angus@redyak.com.au>
Adding multi_net case for UDP only, as TCP timing is hard to test reliably.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implementation added for various ports in the parent commits.This work was funded through GitHub Sponsors.Signed-off-by: Angus Gratton <angus@redyak.com.au>
Code size report:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## master #17312 +/- ##======================================= Coverage 98.54% 98.54% ======================================= Files 169 169 Lines 21897 21897 ======================================= Hits 21579 21579 Misses 318 318 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
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.
Summary
Goal of this PR is to have support for the
MSG_DONTWAIT
andMSG_PEEK
flags for socketrecv
&recvfrom
on unix, esp32, and all "bare metal" LWIP ports.MSG_PEEK
constant is now exposed to Python code.flags
argument.Note: Zephyr & CC3200 ports have their own
socket
module implementations, support not added to these yet. Zephyr looks like it would be trivially easy, CC3200 I didn't look into.Testing
Trade-offs and Alternatives
MSG_PEEK
is motivated by wanting to improve the DTLS support. AddingMSG_DONTWAIT
was relatively easy, and both of these flags are potentially useful for socket programming on MicroPython. However I guess the obvious alternative is not to add them, or to implement them via a Python wrapper in the Python socket module (which would be hacky but possible).