mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
fix(ext/websocket): panic on no next ws message from an already closed stream (#16004)
This commit is contained in:
parent
225d516466
commit
9c7a5c0c61
1 changed files with 3 additions and 1 deletions
|
@ -489,7 +489,9 @@ pub async fn op_ws_next_event(
|
||||||
Some(Ok(Message::Pong(_))) => NextEventResponse::Pong,
|
Some(Ok(Message::Pong(_))) => NextEventResponse::Pong,
|
||||||
Some(Err(e)) => NextEventResponse::Error(e.to_string()),
|
Some(Err(e)) => NextEventResponse::Error(e.to_string()),
|
||||||
None => {
|
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
|
NextEventResponse::Closed
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue