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

Close connection fast if both sides sent FIN #3009

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Close connection fast if both sides sent FIN #3009

merged 2 commits into from
Jan 17, 2025

Conversation

cpq
Copy link
Member

@cpq cpq commented Jan 14, 2025

No description provided.

@cpq cpq requested review from scaprile and robertc2000 January 14, 2025 14:46
Copy link
Collaborator

@robertc2000 robertc2000 left a comment

Choose a reason for hiding this comment

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

Looks good to me! I agree, if this improves performance, then we should close earlier.

Copy link
Collaborator

@scaprile scaprile left a comment

Choose a reason for hiding this comment

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

We can't set is_closing right away if dealing with TLS.
If the last segment we received had more than one TLS record, we need several calls to handle_tls_recv(c), so we must skip this if is_tls.
However, closure will only happen when the timeout expires, as we'll never revisit this.

Maybe we could do this check at mg_mgr_poll() along with c->is_tls && mg_tls_pending(c) > 0:

if (c->s->fin_rcvd && c->s->ttype == MIP_TTYPE_FIN) && (!c->is_tls || mg_tls_pending(c) <= 0))
      c->is_closing = true;

src/net_builtin.c Outdated Show resolved Hide resolved
src/net_builtin.c Outdated Show resolved Hide resolved
src/net_builtin.c Outdated Show resolved Hide resolved
@scaprile scaprile merged commit 74b3fd2 into master Jan 17, 2025
43 of 80 checks passed
@scaprile scaprile deleted the fin branch January 17, 2025 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants