diff --git a/Cargo.lock b/Cargo.lock index f526b1983bd..a3e98555eca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3500,7 +3500,7 @@ dependencies = [ [[package]] name = "libp2p-webrtc-utils" -version = "0.2.0" +version = "0.2.1" dependencies = [ "asynchronous-codec", "bytes", diff --git a/Cargo.toml b/Cargo.toml index eca9c381b5d..8c8c0a70fd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ libp2p-tls = { version = "0.4.0", path = "transports/tls" } libp2p-uds = { version = "0.40.0", path = "transports/uds" } libp2p-upnp = { version = "0.2.2", path = "protocols/upnp" } libp2p-webrtc = { version = "0.7.1-alpha", path = "transports/webrtc" } -libp2p-webrtc-utils = { version = "0.2.0", path = "misc/webrtc-utils" } +libp2p-webrtc-utils = { version = "0.2.1", path = "misc/webrtc-utils" } libp2p-webrtc-websys = { version = "0.3.0-alpha", path = "transports/webrtc-websys" } libp2p-websocket = { version = "0.43.0", path = "transports/websocket" } libp2p-websocket-websys = { version = "0.3.2", path = "transports/websocket-websys" } diff --git a/misc/webrtc-utils/CHANGELOG.md b/misc/webrtc-utils/CHANGELOG.md index 6949113a377..b69bf74bfc8 100644 --- a/misc/webrtc-utils/CHANGELOG.md +++ b/misc/webrtc-utils/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.1 + +- Fix end of stream handling when buffer is empty or not present. + See [PR 5439](https://github.com/libp2p/rust-libp2p/pull/5439). + ## 0.2.0 - Update to latest version of `libp2p-noise`. diff --git a/misc/webrtc-utils/Cargo.toml b/misc/webrtc-utils/Cargo.toml index f548773b8dd..d870e43781e 100644 --- a/misc/webrtc-utils/Cargo.toml +++ b/misc/webrtc-utils/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" name = "libp2p-webrtc-utils" repository = "https://github.com/libp2p/rust-libp2p" rust-version = { workspace = true } -version = "0.2.0" +version = "0.2.1" publish = true [dependencies] diff --git a/misc/webrtc-utils/src/stream.rs b/misc/webrtc-utils/src/stream.rs index 0e1496eb640..17f746a92a1 100644 --- a/misc/webrtc-utils/src/stream.rs +++ b/misc/webrtc-utils/src/stream.rs @@ -146,8 +146,14 @@ where } debug_assert!(read_buffer.is_empty()); - if let Some(message) = message { - *read_buffer = message.into(); + match message { + Some(msg) if !msg.is_empty() => { + *read_buffer = msg.into(); + } + _ => { + tracing::debug!("poll_read buffer is empty, received None"); + return Poll::Ready(Ok(0)); + } } } None => {