Skip to content

tokio-quiche: report why a client handshake closed - #2901

Open
cf-rhett wants to merge 1 commit into
cloudflare:masterfrom
cf-rhett:rhett/handshake-close-error
Open

cf-rhett wants to merge 1 commit into
cloudflare:masterfrom
cf-rhett:rhett/handshake-close-error

Conversation

@cf-rhett

@cf-rhett cf-rhett commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

When a client connection closes before its handshake completes, the connector returns "connection … timed out" and drops quiche's close details. A client that rejected the server's certificate can't tell that apart from a peer close or a real timeout, even though quiche recorded the TLS alert it sent.

This puts a HandshakeClosed inside that io::Error, carrying the local and peer CONNECTION_CLOSE errors and whether the idle timeout fired, and adds ConnectionError::tls_alert() to decode the alert from a CRYPTO_ERROR close code. The error kind is unchanged, so callers that classify by kind see no difference, and the message now says why the connection closed instead of always "timed out".

@cf-rhett
cf-rhett marked this pull request as ready for review November 20, 2026 01:21
@cf-rhett
cf-rhett requested a review from a team as a code owner November 20, 2026 01:21
@cf-rhett
cf-rhett force-pushed the rhett/handshake-close-error branch 2 times, most recently from f16eb7d to 486c1b7 Compare November 20, 2026 01:55
The client connector reported any connection that closed before its
handshake completed as "timed out", dropping quiche's close details. A
client that rejected the server's certificate couldn't tell that apart
from a peer close or a real timeout.

The error's inner value is now a HandshakeClosed carrying the local and
peer CONNECTION_CLOSE errors and whether the idle timeout fired, and
its message says which of those happened. The io::ErrorKind is
unchanged.

ConnectionError::tls_alert() decodes the TLS alert from a CRYPTO_ERROR
close code, so callers don't need to know the 0x100 offset.
@cf-rhett
cf-rhett force-pushed the rhett/handshake-close-error branch from 486c1b7 to 121ff73 Compare November 30, 2026 12:44

This branch has not been deployed

No deployments
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.

1 participant