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

Revert "Expose the Handshake Confirmed state" #1957

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 0 additions & 6 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2460,9 +2460,6 @@ impl Connection {
}

self.events.push_back(Event::Connected);
if self.side.is_server() {
self.events.push_back(Event::HandshakeConfirmed);
}
self.state = State::Established;
trace!("established");
Ok(())
Expand Down Expand Up @@ -2872,7 +2869,6 @@ impl Connection {
));
}
if self.spaces[SpaceId::Handshake].crypto.is_some() {
self.events.push_back(Event::HandshakeConfirmed);
self.discard_space(now, SpaceId::Handshake);
}
}
Expand Down Expand Up @@ -3715,8 +3711,6 @@ pub enum Event {
HandshakeDataReady,
/// The connection was successfully established
Connected,
/// The handshake was [`confirmed`](https://www.rfc-editor.org/rfc/rfc9001#name-handshake-confirmed)
HandshakeConfirmed,
/// The connection was lost
///
/// Emitted if the peer closes the connection or an error is encountered.
Expand Down
16 changes: 0 additions & 16 deletions quinn-proto/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,6 @@ fn zero_rtt_happypath() {
pair.server_conn_mut(server_ch).poll(),
Some(Event::Connected)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeConfirmed)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::Stream(StreamEvent::Opened { dir: Dir::Uni }))
Expand Down Expand Up @@ -628,10 +624,6 @@ fn zero_rtt_rejection() {
pair.server_conn_mut(server_ch).poll(),
Some(Event::Connected)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeConfirmed)
);
assert_matches!(pair.server_conn_mut(server_ch).poll(), None);
pair.client
.connections
Expand Down Expand Up @@ -673,10 +665,6 @@ fn zero_rtt_rejection() {
pair.server_conn_mut(server_ch).poll(),
Some(Event::Connected)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeConfirmed)
);
assert_matches!(pair.server_conn_mut(server_ch).poll(), None);
let s2 = pair.client_streams(client_ch).open(Dir::Uni).unwrap();
assert_eq!(s, s2);
Expand Down Expand Up @@ -754,10 +742,6 @@ fn test_zero_rtt_incoming_limit<F: FnOnce(&mut ServerConfig)>(configure_server:
pair.server_conn_mut(server_ch).poll(),
Some(Event::Connected)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeConfirmed)
);
assert_matches!(
pair.server_conn_mut(server_ch).poll(),
Some(Event::Stream(StreamEvent::Opened { dir: Dir::Uni }))
Expand Down
8 changes: 0 additions & 8 deletions quinn-proto/src/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ impl Pair {
self.client_conn_mut(client_ch).poll(),
Some(Event::Connected { .. })
);
assert_matches!(
self.client_conn_mut(client_ch).poll(),
Some(Event::HandshakeConfirmed)
);
assert_matches!(
self.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeDataReady)
Expand All @@ -239,10 +235,6 @@ impl Pair {
self.server_conn_mut(server_ch).poll(),
Some(Event::Connected { .. })
);
assert_matches!(
self.server_conn_mut(server_ch).poll(),
Some(Event::HandshakeConfirmed)
);
}

pub(super) fn client_conn_mut(&mut self, ch: ConnectionHandle) -> &mut Connection {
Expand Down
24 changes: 1 addition & 23 deletions quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,22 +349,6 @@ impl Connection {
}
}

/// Wait for the connection to enter the [`Handshake
/// Confirmed`](https://www.rfc-editor.org/rfc/rfc9001#name-handshake-confirmed) state
///
/// For servers, this is the same as the time the connection becomes established. For clients,
/// this is the earliest time at which a client can know that the server has accepted client
/// authentication, typically one round-trip after the connection becomes established.
pub async fn handshake_confirmed(&self) -> Result<(), ConnectionError> {
self.0.shared.handshake_confirmed.notified().await;
self.0
.state
.lock("handshake_confirmed")
.error
.as_ref()
.map_or(Ok(()), |err| Err(err.clone()))
}

/// Wait for the connection to be closed for any reason
///
/// Despite the return type's name, closed connections are often not an error condition at the
Expand Down Expand Up @@ -571,8 +555,7 @@ impl Connection {
self.0.stable_id()
}

// Update traffic keys spontaneously for testing purposes. Must not be called before the
// handshake is confirmed.
// Update traffic keys spontaneously for testing purposes.
#[doc(hidden)]
pub fn force_key_update(&self) {
self.0
Expand Down Expand Up @@ -944,7 +927,6 @@ pub(crate) struct Shared {
datagram_received: Notify,
datagrams_unblocked: Notify,
closed: Notify,
handshake_confirmed: Notify,
}

pub(crate) struct State {
Expand Down Expand Up @@ -1102,9 +1084,6 @@ impl State {
wake_all(&mut self.stopped);
}
}
HandshakeConfirmed => {
shared.handshake_confirmed.notify_waiters();
}
ConnectionLost { reason } => {
self.terminate(reason, shared);
}
Expand Down Expand Up @@ -1206,7 +1185,6 @@ impl State {
shared.stream_incoming[Dir::Bi as usize].notify_waiters();
shared.datagram_received.notify_waiters();
shared.datagrams_unblocked.notify_waiters();
shared.handshake_confirmed.notify_waiters();
if let Some(x) = self.on_connected.take() {
let _ = x.send(false);
}
Expand Down