diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-10-15 12:08:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 11:08:09 +0200 |
commit | 9c7a5c0c616eb309b582d61b61b9ef1cc4526909 (patch) | |
tree | 93dc229e6dbca0270647882e6fcb84697562d8fd /ext/websocket/lib.rs | |
parent | 225d516466a37a3695e051ca29456e424cb99aa2 (diff) |
fix(ext/websocket): panic on no next ws message from an already closed stream (#16004)
Diffstat (limited to 'ext/websocket/lib.rs')
-rw-r--r-- | ext/websocket/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs index e8ada74a2..a31431377 100644 --- a/ext/websocket/lib.rs +++ b/ext/websocket/lib.rs @@ -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 } }; |