diff --git a/actix-ws/CHANGELOG.md b/actix-ws/CHANGELOG.md index 97e4ccf46..a26894008 100644 --- a/actix-ws/CHANGELOG.md +++ b/actix-ws/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Take the encoded buffer when yielding bytes in the response stream rather than splitting the buffer, reducing memory use - Remove type parameters from `Session::{text, binary}()` methods, replacing with equivalent `impl Trait` parameters. - `Session::text()` now receives an `impl Into`, making broadcasting text messages more efficient. - Allow sending continuations via `Session::continuation()` diff --git a/actix-ws/src/fut.rs b/actix-ws/src/fut.rs index 913cc1d14..786240485 100644 --- a/actix-ws/src/fut.rs +++ b/actix-ws/src/fut.rs @@ -108,7 +108,7 @@ impl Stream for StreamingBody { } if !this.buf.is_empty() { - return Poll::Ready(Some(Ok(this.buf.split().freeze()))); + return Poll::Ready(Some(Ok(std::mem::take(&mut this.buf).freeze()))); } Poll::Pending