Skip to content

Commit

Permalink
Do not consume buf on first flush tokio bufread decoder impl
Browse files Browse the repository at this point in the history
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
  • Loading branch information
NobodyXu authored Oct 16, 2024
1 parent cb122d4 commit eb07612
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tokio/bufread/generic/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
}
});

first = false;
if !first {
let len = input.written().len();
this.reader.as_mut().consume(len);
}

let len = input.written().len();
this.reader.as_mut().consume(len);
first = false;

if res? {
State::Flushing
Expand Down

0 comments on commit eb07612

Please sign in to comment.