-
Notifications
You must be signed in to change notification settings - Fork 8.2k
net: context: Call send_cb for TCP after ACK is received #172
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
Conversation
Change the TCP send_cb call to be done after we have received ACK to sent packet. It did not make much sense to call the callback immediately (synchronously) after we sent the net_pkt. Signed-off-by: Jukka Rissanen <[email protected]>
|
No complaints on the code, but you might want to make this configurable. This adds significant code size, won't naturally compile itself out if unused, and is only going to be useful to a small handful of apps. I mean, it's undeniably cool, but Berkeley sockets don't actually provide a way to know when data is acked at all, and the world has survived. An alternative way to achieve the same feature, FWIW, would be a "bytes_still_bufferd()" API or equivalent that would tell the user how far behind the current write point the latest ACK is. Might be smaller. |
|
Indeed the BSD sockets do not provide this kind of feature and world has survived. I have a real use case for this feature and it is related to how zephyr network stack works currently.
|
|
Let's abandon this patch for time being. I was testing this with http-server which disconnects the client after serving the request. This connection tear-down is very fast and causes some packet resends by the client. This is probably acceptable trade off and we avoid bringing extra code that is only handling a rare use case. |
|
The original code, if we need it later, can be found at jukkar#4 |
|
I didn't have a chance to look at this before, and so far just quickly skimmed thru the link posted above. I however can share following thought. There can be 2 policies for sending:
Approach no.1 doesn't require "sent" callback at all, but a thread working like that effectively DoSes all other threads (indeed, with few threads working like that we'll likely get a deadlock in the current Zephyr). Approach no.2 requires reliably working "sent" callback, i.e. it indeed should be called once data are truly acked (or fully undeliverable), not after 1st attempt to send data out. Consequently, I'd argue that this feature is required, though approach to implementation may vary indeed. |
|
And - forgot to add that comment - IMHO it doesn't help to close such patches prematurely. I understand there's a concern that such may clog the queue, but some issues can't be resolved from first attempt, and IMHO it's better to keep them around (at least for few weeks) so people can think about them. We seem to have "in progress" label to keep PRs organized (or maybe can add explicit "rfc" or "wip" labels). |
|
The PR is not lost yet and I can resubmit it after 1.8 so we can ponder this case a bit more. |
Fixes issue zephyrproject-rtos#172. Signed-off-by: Geoff Gustafson <[email protected]>
Change the TCP send_cb call to be done after we have received
ACK to sent packet. It did not make much sense to call the
callback immediately (synchronously) after we sent the net_pkt.
Signed-off-by: Jukka Rissanen [email protected]