Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ impl<R: AsyncBufRead, E: EncodeV2> AsyncRead for Encoder<R, E> {
}

let mut output = WriteBuffer::new_initialized(buf);
self.do_poll_read(cx, &mut output)
.map_ok(|()| output.written_len())
match self.do_poll_read(cx, &mut output) {
Poll::Pending if output.written().is_empty() => Poll::Pending,
Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
_ => Poll::Ready(Ok(output.written_len())),
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/async-compression/src/generic/bufread/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Encoder {

read += input.written().len();

// Poll for more data
self.state = State::Encoding(read);
break;
}
}
Expand Down
6 changes: 5 additions & 1 deletion crates/async-compression/src/tokio/bufread/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ fn poll_read(
unsafe { buf.assume_init(initialized) };
buf.advance(written);

res
match res {
Poll::Pending if written == 0 => Poll::Pending,
Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
_ => Poll::Ready(Ok(())),
}
}