Skip to content

Commit

Permalink
refactor(ext/websocket): use concrete error type (#26226)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats authored and bartlomieju committed Oct 25, 2024
1 parent 374049b commit 998a371
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 97 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion ext/http/http_next.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ pub async fn op_http_upgrade_websocket_next(

// Stage 3: take the extracted raw network stream and upgrade it to a websocket, then return it
let (stream, bytes) = extract_network_stream(upgraded);
ws_create_server_stream(&mut state.borrow_mut(), stream, bytes)
Ok(ws_create_server_stream(
&mut state.borrow_mut(),
stream,
bytes,
))
}

#[op2(fast)]
Expand Down
8 changes: 5 additions & 3 deletions ext/http/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,11 @@ async fn op_http_upgrade_websocket(

let (transport, bytes) =
extract_network_stream(hyper_v014::upgrade::on(request).await?);
let ws_rid =
ws_create_server_stream(&mut state.borrow_mut(), transport, bytes)?;
Ok(ws_rid)
Ok(ws_create_server_stream(
&mut state.borrow_mut(),
transport,
bytes,
))
}

// Needed so hyper can use non Send futures
Expand Down
1 change: 1 addition & 0 deletions ext/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ hyper-util.workspace = true
once_cell.workspace = true
rustls-tokio-stream.workspace = true
serde.workspace = true
thiserror.workspace = true
tokio.workspace = true
Loading

0 comments on commit 998a371

Please sign in to comment.