-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extmod/modlwip,esp32,unix: Add support for socket recv flags argument #17312
Conversation
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 21898 21898
=======================================
Hits 21579 21579
Misses 319 319 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
This looks good, thanks!
I tested on ESP8266, RPI_PICO2_W-RISCV and ESP32_GENERIC, and all the new tests pass.
2308215
to
3c2eaf3
Compare
Have updated the tests and run on various ports (updated in description), but have found what looks like a lower level issue on RPI_PICO_W and RPI_PICO2_W. The new |
3c2eaf3
to
14f7f61
Compare
One interesting thing in the output with
But the runs which fail always seem to be:
Weirdly this ordering seems to be happening internal to the CYW43 module, packet captures of successful runs on the Wi-Fi AP always show the second ordering over the air (RX, RX, TX) even though the trace log shows (RX, TX, RX). |
355ef35
to
7f76f49
Compare
Implements MSG_PEEK and MSG_DONTWAIT. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
Implements MSG_PEEK and MSG_DONTWAIT (both passed through to LWIP sockets API). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
Adds TCP and UDP multi_net test cases. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
Adding multi_net case for UDP only, as TCP timing is hard to test reliably. Signed-off-by: Angus Gratton <[email protected]>
Implementation added for various ports in the parent commits. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
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.
I've re-reviewed this, it looks good.
I also tested on PYBD_SF2, RPI_PICO_W and ESP32_GENERIC. The new tests all pass, and so do existing ones (with known failures).
7f76f49
to
ba92063
Compare
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
as well 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).