Skip to content

LWIPStack: set sockets non-blocking #13205

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 2 commits into from
Jul 1, 2020
Merged

Conversation

kjbracey
Copy link
Contributor

Summary of changes

When sockets were opened, they were not set non-blocking, but only had their timeout set to 1ms.

TCP sockets were set to non-blocking on connect or accept, but UDP sockets were left blocking with 1ms timeout.

This led to unnecessary delays when checking for data from an empty UDP socket.

Change sockets to be non-blocking on open instead of setting the timeout. As TCP sockets were already non-blocking, the necessary event handling is already in place, and no other changes are required.

Impact of changes

Fixes #13197

Migration actions required

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


When sockets were opened, they were not set non-blocking, but only had
their timeout set to 1ms.

TCP sockets were set to non-blocking on connect or accept, but UDP
sockets were left blocking with 1ms timeout.

This led to unnecessary delays when checking for data from an empty UDP
socket.

Change sockets to be non-blocking on open instead of setting the
timeout. As TCP sockets were already non-blocking, the necessary event
handling is already in place, and no other changes are required.
0xc0170
0xc0170 previously approved these changes Jun 30, 2020
@kjbracey
Copy link
Contributor Author

Planning to add a commit which turns off the receive timeout option from lwip, to save a bit of RAM/ROM

We no longer use the receive timeout option in lwIP, so disable it to
save a small amount of ROM+RAM.
@mergify mergify bot dismissed 0xc0170’s stale review June 30, 2020 08:49

Pull request has been modified.

@ciarmcom
Copy link
Member

@kjbracey-arm, thank you for your changes.
@ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-maintainers please review.

@ciarmcom ciarmcom requested review from a team June 30, 2020 09:00
@mergify mergify bot added needs: CI and removed needs: review labels Jun 30, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Jun 30, 2020

CI started

@mbed-ci
Copy link

mbed-ci commented Jun 30, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 added the release-type: patch Indentifies a PR as containing just a patch label Jul 1, 2020
@0xc0170 0xc0170 merged commit 663492a into ARMmbed:master Jul 1, 2020
@mergify mergify bot removed the ready for merge label Jul 1, 2020
@adbridge adbridge added release-version: 6.2.0 Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Jul 15, 2020
@kjbracey kjbracey deleted the lwipnonblock branch January 7, 2021 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-blocking recv() isn't really non-blocking with lwip stack
5 participants