add back handle_handshake calls

This commit is contained in:
Toshit Chawda 2024-11-18 20:56:36 -08:00
parent 7362d512b9
commit b75f0a2c47
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
2 changed files with 15 additions and 3 deletions

View file

@ -44,10 +44,16 @@ async fn handshake<R: WebSocketRead>(
(closure)(&mut builders).await?;
send_info_packet(tx, &mut builders).await?;
let mut supported_extensions = get_supported_extensions(info.extensions, &mut builders);
for extension in supported_extensions.iter_mut() {
extension.handle_handshake(rx, tx).await?;
}
Ok((
WispHandshakeResult {
kind: WispHandshakeResultKind::V2 {
extensions: get_supported_extensions(info.extensions, &mut builders),
extensions: supported_extensions,
},
downgraded: false,
},

View file

@ -44,10 +44,16 @@ async fn handshake<R: WebSocketRead>(
Packet::maybe_parse_info(rx.wisp_read_frame(tx).await?, Role::Server, &mut builders)?;
if let PacketType::Info(info) = packet.packet_type {
let mut supported_extensions = get_supported_extensions(info.extensions, &mut builders);
for extension in supported_extensions.iter_mut() {
extension.handle_handshake(rx, tx).await?;
}
// v2 client
Ok(WispHandshakeResult {
kind: WispHandshakeResultKind::V2 {
extensions: get_supported_extensions(info.extensions, &mut builders),
extensions: supported_extensions,
},
downgraded: false,
})
@ -55,7 +61,7 @@ async fn handshake<R: WebSocketRead>(
// downgrade to v1
Ok(WispHandshakeResult {
kind: WispHandshakeResultKind::V1 {
frame: Some(packet.into()),
frame: Some(packet),
},
downgraded: true,
})