-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sock: amend API to iterate over stack-internal buffer chunks #13779
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
sock: amend API to iterate over stack-internal buffer chunks #13779
Conversation
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.
The API design looks sound to me.
That's not entirely true - it must now return 0 when called with |
You should adapt the existing implementation to the API change.
I think the API would be easier to use if instead you introduce an additional |
I'd like to keep the API minimal. The correct way to use it would be in a while-loop anyway. |
Just noticed - you should probably also amend |
I just had another idea 😅 |
Ok, I restructured it a bit and now it somewhat addresses your comment about having to call this function more than once. This is still the case, however, the second call will release the internal context implicitly (what was required to before explicitly using |
Nice. That 'forces' the user to always use the API properly and recuses the API surface. I reckon there is no use for the content of |
(Murdock has found some issues) |
Mostly yes. For the lwIP implementation I use the |
Huh? The change did not run yet. |
Oh sorry, I confused this with #13701 |
This looks good now - please squash. |
With lwIP we have a chunked UDP payload, so just providing the stack-internal buffer is not possible. To be able to iterate over such a chunked payload, this change allows the `sock_*_recv_buf()` functions to use the internal buffer context as an iteration state. As the internal buffer space can be released when the function would return 0, `sock_recv_buf_free()` becomes unnecessary.
32efaa2
to
e4c4320
Compare
Done. Also fixed some doc issues while I was at it ;-). |
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.
API change makes sense and enforces the right behavior of the caller.
Contribution description
With lwIP we have a chunked UDP payload, so just providing the stack-internal buffer is not possible. To be able to iterate over such a chunked payload, this change allows the
sock_*_recv_buf()
functions to use the internal buffer context as an iteration state. Since the newly required handling of the context requires an iteration anyways,sock_recv_buf_free()
becomes unnecessary.As this function is still experimental (I piggy-backed the badge for that) this API change only should require 1 ACK.
Testing procedure
Read the doc and
should still pass.
Issues/PRs references
Needed for #13701.