Skip to content
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

Send incomplete fin packets even if nagle enabled #665

Merged
merged 1 commit into from Aug 16, 2022

Conversation

mbirtwell
Copy link
Contributor

If we have an incomplete packet to send and the socket has been closed
then send it. Without this change (with nagle enabled) we wait for the
penultimate packet in the stream to be acked before sending the final
packet even if there's plenty of space in the window.

I think this is strictly only an optimisation, but when I wrote the code I thought it was necessary.

If there is no packet loss this change saves you a RTT before sending the final packet in the stream (plus any ack delay). If there is incoming packet loss so that you've missed an ACK, this change might additionally save you from having to do some retransmission. Once the far end has received the FIN/ACK it can drive retransmission if that gets dropped.

If we have an incomplete packet to send and the socket has been closed
then send it. Without this change (with nagle enabled) we wait for the
penultimate packet in the stream to be acked before sending the final
packet even if there's plenty of space in the window.
Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Makes a lot of sense, there's no point in delaying the last packet indeed. Nice find!

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 16, 2022

Build succeeded:

@bors bors bot merged commit 4c42b1f into smoltcp-rs:master Aug 16, 2022
@mbirtwell mbirtwell deleted the ignore_nagle_if_want_fin branch August 16, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants