From c8d9d064365e7436d2890097d9a32385202ef525 Mon Sep 17 00:00:00 2001 From: Alex Wied <543423+centromere@users.noreply.github.com> Date: Thu, 31 Oct 2024 22:37:45 -0400 Subject: [PATCH] Ensure TCP connection is properly shut down when session is dropped --- actix-ws/CHANGELOG.md | 1 + actix-ws/src/stream.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/actix-ws/CHANGELOG.md b/actix-ws/CHANGELOG.md index 5a50f8ead..ab9961294 100644 --- a/actix-ws/CHANGELOG.md +++ b/actix-ws/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Unreleased +- Ensure TCP connection is properly shut down when session is dropped ## 0.3.0 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 } }