From fd60da577d5b72e615c8c1537f7ce6130915b864 Mon Sep 17 00:00:00 2001 From: SirCipher Date: Thu, 27 Jun 2024 15:07:42 +0100 Subject: [PATCH 1/2] Relaxes bounds when creating sockets --- ratchet_core/src/framed/mod.rs | 10 ++++++---- ratchet_core/src/ws.rs | 7 ++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ratchet_core/src/framed/mod.rs b/ratchet_core/src/framed/mod.rs index 98573fd..4665b40 100644 --- a/ratchet_core/src/framed/mod.rs +++ b/ratchet_core/src/framed/mod.rs @@ -433,10 +433,7 @@ pub struct FramedIo { max_message_size: usize, } -impl FramedIo -where - I: WebSocketStream, -{ +impl FramedIo { #[cfg(feature = "split")] pub fn from_parts(parts: FramedIoParts) -> FramedIo { let FramedIoParts { @@ -497,7 +494,12 @@ where pub fn is_server(&self) -> bool { self.flags.contains(CodecFlags::ROLE) } +} +impl FramedIo +where + I: WebSocketStream, +{ pub async fn flush(&mut self) -> Result<(), Error> { self.io.flush().await?; Ok(()) diff --git a/ratchet_core/src/ws.rs b/ratchet_core/src/ws.rs index e07f635..94939c5 100644 --- a/ratchet_core/src/ws.rs +++ b/ratchet_core/src/ws.rs @@ -96,7 +96,6 @@ pub enum CloseState { impl WebSocket where - S: WebSocketStream, E: Extension, { #[cfg(feature = "split")] @@ -144,7 +143,13 @@ where close_state: CloseState::NotClosed, } } +} +impl WebSocket +where + S: WebSocketStream, + E: Extension, +{ /// Returns the role of this WebSocket. pub fn role(&self) -> Role { if self.framed.is_server() { From 483779ea3b01b8ebec1ff15903fd2d2fe287802c Mon Sep 17 00:00:00 2001 From: SirCipher Date: Thu, 27 Jun 2024 15:10:33 +0100 Subject: [PATCH 2/2] Bumps versions --- ratchet_core/Cargo.toml | 4 ++-- ratchet_deflate/Cargo.toml | 4 ++-- ratchet_ext/Cargo.toml | 2 +- ratchet_fixture/Cargo.toml | 4 ++-- ratchet_rs/Cargo.toml | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ratchet_core/Cargo.toml b/ratchet_core/Cargo.toml index 1baac0b..98968a7 100644 --- a/ratchet_core/Cargo.toml +++ b/ratchet_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratchet_core" -version = "1.0.1" +version = "1.0.2" authors = ["Swim Inc. developers info@swim.ai"] edition = "2021" description = "Async WebSocket implementation" @@ -16,7 +16,7 @@ split = ["futures"] fixture = [] [dependencies] -ratchet_ext = { version = "1.0.1", path = "../ratchet_ext" } +ratchet_ext = { version = "1.0.2", path = "../ratchet_ext" } url = { workspace = true } http = { workspace = true } tokio = { workspace = true, features = ["rt", "net", "io-util"] } diff --git a/ratchet_deflate/Cargo.toml b/ratchet_deflate/Cargo.toml index 11c4c6f..d3f7c81 100644 --- a/ratchet_deflate/Cargo.toml +++ b/ratchet_deflate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratchet_deflate" -version = "1.0.1" +version = "1.0.2" authors = ["Swim Inc. developers info@swim.ai"] edition = "2021" description = "Permessage Deflate for Ratchet" @@ -11,7 +11,7 @@ readme = "README.md" repository = "https://github.com/swimos/ratchet/" [dependencies] -ratchet_ext = { version = "1.0.1", path = "../ratchet_ext" } +ratchet_ext = { version = "1.0.2", path = "../ratchet_ext" } thiserror = { workspace = true } http = { workspace = true } bytes = { workspace = true } diff --git a/ratchet_ext/Cargo.toml b/ratchet_ext/Cargo.toml index 311063c..a3e4379 100644 --- a/ratchet_ext/Cargo.toml +++ b/ratchet_ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratchet_ext" -version = "1.0.1" +version = "1.0.2" authors = ["Swim Inc. developers info@swim.ai"] edition = "2021" description = "WebSocket extensions for Ratchet" diff --git a/ratchet_fixture/Cargo.toml b/ratchet_fixture/Cargo.toml index feb7def..90eacf9 100644 --- a/ratchet_fixture/Cargo.toml +++ b/ratchet_fixture/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratchet_fixture" -version = "1.0.1" +version = "1.0.2" edition = "2021" description = "Ratchet fixture" keywords = ["websocket", "async", "futures", "tokio"] @@ -10,7 +10,7 @@ readme = "README.md" repository = "https://github.com/swimos/ratchet/" [dependencies] -ratchet = { package = "ratchet_rs", version = "1.0.1", path = "../ratchet_rs", features = ["split", "deflate", "fixture"] } +ratchet = { package = "ratchet_rs", version = "1.0.2", path = "../ratchet_rs", features = ["split", "deflate", "fixture"] } tokio = { workspace = true, features = ["io-util"] } bytes = { workspace = true } futures = { workspace = true } diff --git a/ratchet_rs/Cargo.toml b/ratchet_rs/Cargo.toml index 73e4432..f52d491 100644 --- a/ratchet_rs/Cargo.toml +++ b/ratchet_rs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ratchet_rs" -version = "1.0.1" +version = "1.0.2" authors = ["Swim Inc. developers info@swim.ai"] edition = "2021" description = "Async WebSocket implementation" @@ -17,9 +17,9 @@ split = ["ratchet_core/split"] fixture = ["ratchet_core/fixture"] [dependencies] -ratchet_core = { version = "1.0.1", path = "../ratchet_core" } -ratchet_ext = { version = "1.0.1", path = "../ratchet_ext" } -ratchet_deflate = { version = "1.0.1", path = "../ratchet_deflate", optional = true } +ratchet_core = { version = "1.0.2", path = "../ratchet_core" } +ratchet_ext = { version = "1.0.2", path = "../ratchet_ext" } +ratchet_deflate = { version = "1.0.2", path = "../ratchet_deflate", optional = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } log = { workspace = true }