From d9418adcd4e429c17c8a72d782d0db481f879eb0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:53:03 -0500 Subject: [PATCH] Bump tokio-tungstenite from 0.24.0 to 0.26.1 (#2639) * Bump tokio-tungstenite from 0.24.0 to 0.26.1 Bumps [tokio-tungstenite](https://github.com/snapview/tokio-tungstenite) from 0.24.0 to 0.26.1. - [Changelog](https://github.com/snapview/tokio-tungstenite/blob/master/CHANGELOG.md) - [Commits](https://github.com/snapview/tokio-tungstenite/compare/v0.24.0...v0.26.1) --- updated-dependencies: - dependency-name: tokio-tungstenite dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Fix breaking changes --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Guillaume Lagrange --- Cargo.lock | 36 +++++++++++++++++++++-- crates/burn-remote/Cargo.toml | 2 +- crates/burn-remote/src/client/worker.rs | 39 +++++++++++++------------ 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index df293b77b9..73110dd328 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -380,7 +380,7 @@ dependencies = [ "sha1", "sync_wrapper 1.0.2", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.24.0", "tower", "tower-layer", "tower-service", @@ -900,7 +900,7 @@ dependencies = [ "serde", "serde_bytes", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.26.1", "tracing-core", "tracing-subscriber", ] @@ -7661,7 +7661,19 @@ dependencies = [ "futures-util", "log", "tokio", - "tungstenite", + "tungstenite 0.24.0", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4bf6fecd69fcdede0ec680aaf474cdab988f9de6bc73d3758f0160e3b7025a" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.26.1", ] [[package]] @@ -7882,6 +7894,24 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413083a99c579593656008130e29255e54dcaae495be556cc26888f211648c24" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.2.0", + "httparse", + "log", + "rand", + "sha1", + "thiserror 2.0.8", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" diff --git a/crates/burn-remote/Cargo.toml b/crates/burn-remote/Cargo.toml index 8eda4893c7..16a236ac94 100644 --- a/crates/burn-remote/Cargo.toml +++ b/crates/burn-remote/Cargo.toml @@ -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 } diff --git a/crates/burn-remote/src/client/worker.rs b/crates/burn-remote/src/client/worker.rs index dd0236d377..4fe90a126d 100644 --- a/crates/burn-remote/src/client/worker.rs +++ b/crates/burn-remote/src/client/worker.rs @@ -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}, }; @@ -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 @@ -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."); @@ -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."); } });