Skip to content

Send incomplete fin packets even if nagle enabled#665

Merged
bors[bot] merged 1 commit intosmoltcp-rs:masterfrom
OxIonics:ignore_nagle_if_want_fin
Aug 16, 2022
Merged

Send incomplete fin packets even if nagle enabled#665
bors[bot] merged 1 commit intosmoltcp-rs:masterfrom
OxIonics:ignore_nagle_if_want_fin

Conversation

@mbirtwell
Copy link

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.

3 participants