From a2e77d2668e208a38b402f095365680240933f3d Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Tue, 28 Nov 2023 03:47:04 +0000 Subject: [PATCH] Fix for another edge case. --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index cf4cff2..b4ab30f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -517,7 +517,7 @@ where match item { Some(Ok(bytes)) => { if this.found_stream { - return if this.remaining > 0 { + if this.remaining > 0 { let len = std::cmp::min(this.remaining, bytes.len()); this.remaining -= len; if this.remaining == 0 { @@ -525,9 +525,11 @@ where this.buffer.extend_from_slice(&bytes[len..]); this.found_stream = false; } - Poll::Ready(Some(Ok(bytes.slice(0..len)))) + return Poll::Ready(Some(Ok(bytes.slice(0..len)))); } else { - Poll::Ready(None) + this.found_stream = false; + this.buffer.clear(); + this.buffer.extend_from_slice(&bytes); }; } else { this.buffer.extend_from_slice(&bytes);