aboutsummaryrefslogtreecommitdiff
path: root/src/stream.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-25 15:04:52 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-25 15:04:52 +0200
commit74e57016f63b6052cf6d539812859c3a46138eee (patch)
tree9e0dd9a7176d8f977b0dac55242c2870966ee90a /src/stream.rs
parent7499721a10d1d9e977024224b9d80d91ce93628b (diff)
downloadnetapp-74e57016f63b6052cf6d539812859c3a46138eee.tar.gz
netapp-74e57016f63b6052cf6d539812859c3a46138eee.zip
Add some debugging
Diffstat (limited to 'src/stream.rs')
-rw-r--r--src/stream.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/stream.rs b/src/stream.rs
index beb6b9c..5ba2ed4 100644
--- a/src/stream.rs
+++ b/src/stream.rs
@@ -93,7 +93,7 @@ impl ByteStreamReader {
}
pub fn eos(&self) -> bool {
- self.buf.is_empty() && self.eos
+ self.buf_len == 0 && self.eos
}
fn try_get(&mut self, read_len: usize) -> Option<Bytes> {
@@ -164,8 +164,10 @@ impl<'a> Future for ByteStreamReadExact<'a> {
match futures::ready!(this.reader.stream.as_mut().poll_next(cx)) {
Some(Ok(slice)) => {
- this.reader.buf_len += slice.len();
- this.reader.buf.push_back(slice);
+ if !slice.is_empty() {
+ this.reader.buf_len += slice.len();
+ this.reader.buf.push_back(slice);
+ }
}
Some(Err(e)) => {
this.reader.err = Some(e);