fix(relay): close failed accepted handshakes
After a peer is registered, later accepted-handshake failures clean up room and session state. If the welcome was already sent, the joining peer could otherwise keep a live QUIC connection briefly while the relay has removed it from room membership. Close the connection after accepted-handshake cleanup so the peer learns the handshake failed instead of continuing with stale local state. Test Plan: - cargo fmt --check - cargo test -p lanparty-relay - cargo test --workspace - cargo clippy --workspace --all-targets -- -D warnings - git diff --check - git diff --cached --check Refs: MVP lifecycle ordering
This commit is contained in:
@@ -317,6 +317,7 @@ async fn accept_control_handshake(
|
||||
accepted.peer.role() == Role::Client,
|
||||
)
|
||||
.await?;
|
||||
close_failed_accepted_handshake(connection);
|
||||
|
||||
return Err(error);
|
||||
}
|
||||
@@ -332,6 +333,7 @@ async fn accept_control_handshake(
|
||||
accepted.peer.role() == Role::Client,
|
||||
)
|
||||
.await?;
|
||||
close_failed_accepted_handshake(connection);
|
||||
|
||||
return Err(error);
|
||||
}
|
||||
@@ -342,6 +344,10 @@ async fn accept_control_handshake(
|
||||
Ok(Some(accepted))
|
||||
}
|
||||
|
||||
fn close_failed_accepted_handshake(connection: &quinn::Connection) {
|
||||
connection.close(0_u32.into(), b"relay accepted handshake failed");
|
||||
}
|
||||
|
||||
const fn accepted_handshake_steps(role: Role) -> &'static [AcceptedHandshakeStep] {
|
||||
match role {
|
||||
Role::Client => CLIENT_HANDSHAKE_STEPS,
|
||||
|
||||
Reference in New Issue
Block a user