Skip to content

Commit

Permalink
feat(s2n-quic): improve local handshake failure visibility (#2383)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Nov 21, 2024
1 parent c075830 commit d8fe405
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions quic/s2n-quic-tls/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl tls::Session for Session {
.alert()
.map(tls::Error::new)
.unwrap_or(tls::Error::HANDSHAKE_FAILURE)
.with_reason(e.message())
.into())),
Poll::Pending => Poll::Pending,
}
Expand Down
4 changes: 3 additions & 1 deletion quic/s2n-quic-transport/src/connection/connection_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ impl<Config: endpoint::Config> ConnectionImpl<Config> {
datagram,
dc,
) {
Poll::Ready(res) => res?,
Poll::Ready(Ok(())) => {}
// use `from` instead of `into` so the location is correctly captured
Poll::Ready(Err(err)) => return Err(connection::Error::from(err)),
Poll::Pending => return Ok(()),
}

Expand Down
4 changes: 3 additions & 1 deletion quic/s2n-quic-transport/src/space/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,9 @@ pub trait PacketSpace<Config: endpoint::Config>: Sized {
.map_err(on_error)?;

// skip processing any other frames and return an error
return Err(frame.into());

// use `from` instead of `into` so the location is correctly captured
return Err(connection::Error::from(frame));
}
Frame::Stream(frame) => {
let on_error = on_frame_processed!(frame);
Expand Down
2 changes: 2 additions & 0 deletions quic/s2n-quic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ unstable-provider-dc = ["s2n-quic-transport/unstable-provider-dc"]
unstable-congestion-controller = ["s2n-quic-core/unstable-congestion-controller"]
# This feature enables the use of unstable connection limits
unstable-limits = ["s2n-quic-core/unstable-limits"]
# The feature enables the close formatter provider
unstable-provider-connection-close-formatter = []

[dependencies]
bytes = { version = "1", default-features = false }
Expand Down
11 changes: 9 additions & 2 deletions quic/s2n-quic/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ pub mod tls;

// These providers are not currently exposed to applications
#[allow(dead_code)]
pub(crate) mod connection_close_formatter;
#[allow(dead_code)]
pub(crate) mod path_migration;
#[allow(dead_code)]
pub(crate) mod sync;

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-connection-close-formatter"))] {
pub mod connection_close_formatter;
} else {
#[allow(dead_code)]
pub(crate) mod connection_close_formatter;
}
);

cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-packet-interceptor"))] {
pub mod packet_interceptor;
Expand Down

0 comments on commit d8fe405

Please sign in to comment.