Skip to content

Commit

Permalink
fix(ext/websocket): panic on no next ws message from an already close…
Browse files Browse the repository at this point in the history
…d stream (denoland#16004)
  • Loading branch information
aapoalas authored Oct 15, 2022
1 parent 225d516 commit 9c7a5c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ext/websocket/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,9 @@ pub async fn op_ws_next_event(
Some(Ok(Message::Pong(_))) => NextEventResponse::Pong,
Some(Err(e)) => NextEventResponse::Error(e.to_string()),
None => {
state.borrow_mut().resource_table.close(rid).unwrap();
// No message was received, presumably the socket closed while we waited.
// Try close the stream, ignoring any errors, and report closed status to JavaScript.
let _ = state.borrow_mut().resource_table.close(rid);
NextEventResponse::Closed
}
};
Expand Down

0 comments on commit 9c7a5c0

Please sign in to comment.