mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
codec: use advance over split_to when data is not needed (#2198)
This commit is contained in:
@@ -7,7 +7,7 @@ use tokio::{
|
||||
stream::Stream,
|
||||
};
|
||||
|
||||
use bytes::BytesMut;
|
||||
use bytes::{Buf, BytesMut};
|
||||
use futures_core::ready;
|
||||
use futures_sink::Sink;
|
||||
use log::trace;
|
||||
@@ -239,8 +239,7 @@ where
|
||||
.into()));
|
||||
}
|
||||
|
||||
// TODO: Add a way to `bytes` to do this w/o returning the drained data.
|
||||
let _ = pinned.buffer.split_to(n);
|
||||
pinned.buffer.advance(n);
|
||||
}
|
||||
|
||||
// Try flushing the underlying IO
|
||||
|
||||
Reference in New Issue
Block a user