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
Changes from 1 commit
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
Next Next commit
Resend Close Frames
  • Loading branch information
nibanks committed May 19, 2025
commit f7f46e15364e547594d951d8f3fadec62f6bf24a
12 changes: 12 additions & 0 deletions src/core/connection.c
Original file line number Diff line number Diff line change
@@ -4411,6 +4411,18 @@ QuicConnRecvFrames(
uint16_t PayloadLength = Packet->PayloadLength;
uint64_t RecvTime = CxPlatTimeUs64();

//
// RFC 9000 Section 10.2.1:
// In closing state, respond to any packet with CONNECTION_CLOSE, rate-limited
// to once every 5ms.
//
if (Closed && !Connection->State.ShutdownComplete) {
if (RecvTime - Connection->LastCloseResponseTimeUs >= QUIC_CLOSING_RESPONSE_MIN_INTERVAL_US) {
QuicSendSetSendFlag(&Connection->Send, QUIC_CONN_SEND_FLAG_CONNECTION_CLOSE);
Connection->LastCloseResponseTimeUs = RecvTime;
}
}

if (QuicConnIsClient(Connection) &&
!Connection->State.GotFirstServerResponse) {
Connection->State.GotFirstServerResponse = TRUE;
3 changes: 3 additions & 0 deletions src/core/connection.h
Original file line number Diff line number Diff line change
@@ -682,6 +682,9 @@ typedef struct QUIC_CONNECTION {
QUIC_FLOW_BLOCKED_TIMING_TRACKER FlowControl;
} BlockedTimings;

// Timestamp (us) of last CONNECTION_CLOSE sent in closing state (for rate limiting)
uint64_t LastCloseResponseTimeUs;

} QUIC_CONNECTION;

typedef struct QUIC_SERIALIZED_RESUMPTION_STATE {
6 changes: 6 additions & 0 deletions src/core/quicdef.h
Original file line number Diff line number Diff line change
@@ -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.
//
Loading
Oops, something went wrong.