Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump tokio-tungstenite from 0.24.0 to 0.26.1 #2639

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/burn-remote/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ futures-util = { version = "0.3" }

# Client dependencies
async-channel = { workspace = true, optional = true }
tokio-tungstenite = { version = "0.24", optional = true }
tokio-tungstenite = { version = "0.26", optional = true }

# Server dependencies
axum = { version = "0.7.9", features = ["ws"], optional = true }
Expand Down
39 changes: 20 additions & 19 deletions crates/burn-remote/src/client/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::shared::{ConnectionId, SessionId, Task, TaskResponse, TaskResponseCon
use futures_util::{SinkExt, StreamExt};
use std::{collections::HashMap, sync::Arc};
use tokio_tungstenite::{
connect_async_with_config,
connect_async_with_config, tungstenite,
tungstenite::protocol::{Message, WebSocketConfig},
};

Expand Down Expand Up @@ -56,28 +56,29 @@ impl ClientWorker {
log::info!("Connecting to {address_request} ...");
let (mut stream_request, _) = connect_async_with_config(
address_request.clone(),
Some(WebSocketConfig {
max_send_queue: None,
write_buffer_size: 0,
max_write_buffer_size: usize::MAX,
max_message_size: None,
max_frame_size: Some(MB * 512),
accept_unmasked_frames: true,
}),
Some(
WebSocketConfig::default()
.write_buffer_size(0)
.max_message_size(None)
.max_frame_size(Some(MB * 512))
.accept_unmasked_frames(true)
.read_buffer_size(64 * 1024) // 64 KiB (previous default)
),
true,
)
.await
.expect("Failed to connect");
let (mut stream_response, _) = connect_async_with_config(
address_response,
Some(WebSocketConfig {
max_send_queue: None,
write_buffer_size: 0,
max_write_buffer_size: usize::MAX,
max_message_size: None,
max_frame_size: Some(MB * 512),
accept_unmasked_frames: true,
}),
Some(
WebSocketConfig::default()
.write_buffer_size(0)
.max_message_size(None)
.max_frame_size(Some(MB * 512))
.accept_unmasked_frames(true)
.read_buffer_size(64 * 1024) // 64 KiB (previous default)

),
true,
)
.await
Expand All @@ -87,7 +88,7 @@ impl ClientWorker {

// Init the connection.
let session_id = SessionId::new();
let bytes = rmp_serde::to_vec(&Task::Init(session_id)).expect("Can serialize tasks to bytes.");
let bytes: tungstenite::Bytes = rmp_serde::to_vec(&Task::Init(session_id)).expect("Can serialize tasks to bytes.").into();
stream_request.send(Message::Binary(bytes.clone())).await.expect("Can send the message on the websocket.");
stream_response.send(Message::Binary(bytes)).await.expect("Can send the message on the websocket.");

Expand Down Expand Up @@ -129,7 +130,7 @@ impl ClientWorker {
ClientRequest::WithoutCallback(task) => task,

};
let bytes = rmp_serde::to_vec(&task).expect("Can serialize tasks to bytes.");
let bytes = rmp_serde::to_vec(&task).expect("Can serialize tasks to bytes.").into();
stream_request.send(Message::Binary(bytes)).await.expect("Can send the message on the websocket.");
}
});
Expand Down
Loading