Skip to content

Resend Close Frames #5107

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

Merged
merged 7 commits into from
Jun 3, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -4411,6 +4411,19 @@ QuicConnRecvFrames(
uint16_t PayloadLength = Packet->PayloadLength;
uint64_t RecvTime = CxPlatTimeUs64();

//
// In closing state, respond to any packet with a new close frame (rate-limited).
//
if (Closed && !Connection->State.ShutdownComplete) {
if (RecvTime - Connection->LastCloseResponseTimeUs >= QUIC_CLOSING_RESPONSE_MIN_INTERVAL_US) {
QuicSendSetSendFlag(
&Connection->Send,
Connection->State.AppClosed ?
QUIC_CONN_SEND_FLAG_APPLICATION_CLOSE :
QUIC_CONN_SEND_FLAG_CONNECTION_CLOSE);
}
}

if (QuicConnIsClient(Connection) &&
!Connection->State.GotFirstServerResponse) {
Connection->State.GotFirstServerResponse = TRUE;
Expand Down
6 changes: 6 additions & 0 deletions src/core/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ typedef struct QUIC_CONNECTION {
//
uint64_t EarliestExpirationTime;

//
// Timestamp (us) of when we last queued up a connection close (or
// application close) response to be sent.
//
uint64_t LastCloseResponseTimeUs;

//
// Receive packet queue.
//
Expand Down
6 changes: 6 additions & 0 deletions src/core/quicdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ CXPLAT_STATIC_ASSERT(
//
#define QUIC_DEFAULT_HANDSHAKE_IDLE_TIMEOUT 10000

//
// Minimum interval (in microseconds) between CONNECTION_CLOSE responses in
// closing state.
//
#define QUIC_CLOSING_RESPONSE_MIN_INTERVAL_US 5000

//
// The default value for keep alives being enabled or not.
//
Expand Down
1 change: 1 addition & 0 deletions src/core/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ QuicSendSetSendFlag(
}

if (IsCloseFrame) {
Connection->LastCloseResponseTimeUs = CxPlatTimeUs64();
QuicSendClear(Send);
}

Expand Down
Loading