Skip to content

Commit

Permalink
Fix panic if WS handshake fails at runtime (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Schleich authored Nov 26, 2024
1 parent 2d17a82 commit 2cb8749
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zenoh-plugin-remote-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,13 @@ async fn run_websocket_server(
None => Box::new(tcp_stream),
};

let ws_stream = tokio_tungstenite::accept_async(streamable)
.await
.expect("Error during the websocket handshake occurred");
let ws_stream = match tokio_tungstenite::accept_async(streamable).await {
Ok(ws_stream) => ws_stream,
Err(e) => {
error!("Error during the websocket handshake occurred: {}", e);
return;
}
};

let (ws_tx, ws_rx) = ws_stream.split();

Expand Down

0 comments on commit 2cb8749

Please sign in to comment.