Skip to content

Commit e724673

Browse files
committed
Don't reinitialize on reader EOF for other implementations
1 parent 701a3a3 commit e724673

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/tokio/bufread/generic/decoder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
7070
State::Decoding => {
7171
let input = ready!(this.reader.as_mut().poll_fill_buf(cx))?;
7272
if input.is_empty() {
73+
// Avoid attempting to reinitialise the decoder if the reader
74+
// has returned EOF.
75+
*this.multiple_members = false;
7376
State::Flushing
7477
} else {
7578
let mut input = PartialBuffer::new(input);

src/tokio_02/bufread/generic/decoder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
7070
State::Decoding => {
7171
let input = ready!(this.reader.as_mut().poll_fill_buf(cx))?;
7272
if input.is_empty() {
73+
// Avoid attempting to reinitialise the decoder if the reader
74+
// has returned EOF.
75+
*this.multiple_members = false;
7376
State::Flushing
7477
} else {
7578
let mut input = PartialBuffer::new(input);

src/tokio_03/bufread/generic/decoder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ impl<R: AsyncBufRead, D: Decode> Decoder<R, D> {
7070
State::Decoding => {
7171
let input = ready!(this.reader.as_mut().poll_fill_buf(cx))?;
7272
if input.is_empty() {
73+
// Avoid attempting to reinitialise the decoder if the reader
74+
// has returned EOF.
75+
*this.multiple_members = false;
7376
State::Flushing
7477
} else {
7578
let mut input = PartialBuffer::new(input);

0 commit comments

Comments
 (0)