lwip_sock: clean-up connection handling without a sock.#12932
lwip_sock: clean-up connection handling without a sock.#12932miri64 merged 3 commits intoRIOT-OS:masterfrom
Conversation
Either the sock is provided with `sock_*_send()` or not. In the first case the indirection is not necessary, and in the second we need to delete the created `conn` within `lwip_sock_send()` anyway, so returning it makes no sense.
|
Just noticed a simpler check for when to delete the netconn. Let me know what you think. |
|
I agree that these changes make it a lot cleaner and easier to grasp. |
|
Oops, that wasn't my attention... The problem with last minute changes ;-). |
|
Looks good now! Clever way of using the tmp as a universal connection, and later on using the conn again to check if tmp needs to be freed or not, removing the need for an extra flag (like I did in my PR). |
|
@wosym does this work for you? |
|
@benpicco It seems to work, yes.
|
|
Squashed from a hotel room with blocked SSH access... |
|
Mhhh let's try this again. |
|
Can somebody confirm that worked? Git tells me the branch is up-to-date, but I don't see the squash commits in the GitHub interface... |
|
|
The branch even points to the correct commit... crappy hotel wifi is crappy or something is seriously wrong with GitHub... |
Contribution description
This is an enhanced version of #12927. In addition to the fix there, it removes the unnecessary additional indirection of
connas either the sock is provided withsock_*_send()or not. In the first case the indirection is not necessary, and in the second we need to delete the createdconnwithinlwip_sock_send()anyway (as introduced in #12927, so returning it makes no sense.It also adds a check for the call to
lwip_sock_send()by the respective protocol callers, so thatsockis not dereferenced when it isNULLTesting procedure
lwip_socktests should still compile and run for both IPv4 and IPv6 and both network layer protocols combined:case the indirection is not necessary, and in the second we need to
delete the created
connwithinlwip_sock_send()anyway, so returningit makes no sense.
Issues/PRs references
Contains a modified version of #12927.
Fixes #12859.