mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
fix(ext/websocket): drop connection when close frame not ack (#24301)
Fixes #24292
This commit is contained in:
parent
13aa1d70e9
commit
a1ff1a453c
3 changed files with 62 additions and 2 deletions
|
@ -699,10 +699,14 @@ pub async fn op_ws_close(
|
|||
#[smi] code: Option<u16>,
|
||||
#[string] reason: Option<String>,
|
||||
) -> Result<(), AnyError> {
|
||||
let resource = state
|
||||
let Ok(resource) = state
|
||||
.borrow_mut()
|
||||
.resource_table
|
||||
.get::<ServerWebSocket>(rid)?;
|
||||
.get::<ServerWebSocket>(rid)
|
||||
else {
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let frame = reason
|
||||
.map(|reason| Frame::close(code.unwrap_or(1005), reason.as_bytes()))
|
||||
.unwrap_or_else(|| Frame::close_raw(vec![].into()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue