Skip to content

Commit

Permalink
Fix for another edge case.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Nov 28, 2023
1 parent 3e8098d commit a2e77d2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,19 @@ 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 {
this.buffer.clear();
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);
Expand Down

0 comments on commit a2e77d2

Please sign in to comment.