Skip to content

Commit

Permalink
Fix snapshotting test (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmantica11 authored Aug 16, 2024
1 parent c77d1fa commit 5088a3d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/snapshot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ where
cx: &mut std::task::Context<'_>,
buf: &mut ReadBuf<'_>,
) -> Poll<Result<(), std::io::Error>> {
if self.byte_buffer.len() >= buf.remaining_mut() {
buf.put_slice(&self.byte_buffer[..buf.remaining_mut()]);
self.byte_buffer.drain(..buf.remaining_mut());
if self.byte_buffer.len() > 0 {
let len = std::cmp::min(self.byte_buffer.len(), buf.remaining_mut());
buf.put_slice(&self.byte_buffer[..len]);
self.byte_buffer.drain(..len);
return Poll::Ready(Ok(()));
}
match futures::ready!(self.stream.poll_next_unpin(cx)) {
Expand Down

0 comments on commit 5088a3d

Please sign in to comment.