Skip to content

Commit 7888d0f

Browse files
fix(cable): surface tunnel connection errors via send_error
Both the QR-code and known-device channel tasks called protocol::connection(tunnel_input).await; ux_sender.set_connection_state(Terminated).await and discarded the result. With the previous commit propagating post-handshake faults, route Err(e) through send_error so the broadcast subscribers see a CableUpdate::Error before the channel state transitions to Terminated. send_error already performs the Terminated transition itself.
1 parent 77487e5 commit 7888d0f

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

libwebauthn/src/transport/cable/known_devices.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,17 @@ impl<'d> Device<'d, Cable, CableChannel> for CableKnownDevice {
223223
cbor_rx_send,
224224
);
225225

226-
protocol::connection(tunnel_input).await;
227-
ux_sender
228-
.set_connection_state(ConnectionState::Terminated)
229-
.await;
226+
match protocol::connection(tunnel_input).await {
227+
Ok(()) => {
228+
ux_sender
229+
.set_connection_state(ConnectionState::Terminated)
230+
.await;
231+
}
232+
Err(e) => {
233+
// send_error already transitions to Terminated.
234+
ux_sender.send_error(e).await;
235+
}
236+
}
230237
});
231238

232239
Ok(CableChannel {

libwebauthn/src/transport/cable/qr_code_device.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,17 @@ impl<'d> Device<'d, Cable, CableChannel> for CableQrCodeDevice {
271271
cbor_tx_recv,
272272
cbor_rx_send,
273273
);
274-
protocol::connection(tunnel_input).await;
275-
276-
ux_sender
277-
.set_connection_state(ConnectionState::Terminated)
278-
.await;
274+
match protocol::connection(tunnel_input).await {
275+
Ok(()) => {
276+
ux_sender
277+
.set_connection_state(ConnectionState::Terminated)
278+
.await;
279+
}
280+
Err(e) => {
281+
// send_error already transitions to Terminated.
282+
ux_sender.send_error(e).await;
283+
}
284+
}
279285
});
280286

281287
Ok(CableChannel {

0 commit comments

Comments
 (0)