From 98847b9279c752e5f60135675a2ead122db5a9ce Mon Sep 17 00:00:00 2001 From: Alex Wied <543423+centromere@users.noreply.github.com> Date: Sun, 29 Dec 2024 11:57:56 -0500 Subject: [PATCH] fix: ensure TCP connection is properly shut down when Session is dropped (#476) * Ensure TCP connection is properly shut down when session is dropped * Update CHANGELOG.md --------- Co-authored-by: Rob Ede --- actix-ws/CHANGELOG.md | 2 ++ actix-ws/src/stream.rs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/actix-ws/CHANGELOG.md b/actix-ws/CHANGELOG.md index 5a50f8ead..086c19e6e 100644 --- a/actix-ws/CHANGELOG.md +++ b/actix-ws/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Ensure TCP connection is properly shut down when session is dropped. + ## 0.3.0 - Add `AggregatedMessage[Stream]` types. diff --git a/actix-ws/src/stream.rs b/actix-ws/src/stream.rs index e95c17f43..fcca98168 100644 --- a/actix-ws/src/stream.rs +++ b/actix-ws/src/stream.rs @@ -145,6 +145,10 @@ impl Stream for StreamingBody { return Poll::Ready(Some(Ok(mem::take(&mut this.buf).freeze()))); } + if this.closing { + return Poll::Ready(None); + } + Poll::Pending } }