mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-07 00:00:08 +02:00
io: remove erroneous wake call in SinkWriter (#5436)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
use futures_core::ready;
|
||||||
use futures_sink::Sink;
|
use futures_sink::Sink;
|
||||||
|
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
@@ -98,19 +99,11 @@ where
|
|||||||
buf: &[u8],
|
buf: &[u8],
|
||||||
) -> Poll<Result<usize, io::Error>> {
|
) -> Poll<Result<usize, io::Error>> {
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
match this.inner.as_mut().poll_ready(cx) {
|
|
||||||
Poll::Ready(Ok(())) => {
|
ready!(this.inner.as_mut().poll_ready(cx).map_err(Into::into))?;
|
||||||
if let Err(e) = this.inner.as_mut().start_send(buf) {
|
match this.inner.as_mut().start_send(buf) {
|
||||||
Poll::Ready(Err(e.into()))
|
Ok(()) => Poll::Ready(Ok(buf.len())),
|
||||||
} else {
|
Err(e) => Poll::Ready(Err(e.into())),
|
||||||
Poll::Ready(Ok(buf.len()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Poll::Ready(Err(e)) => Poll::Ready(Err(e.into())),
|
|
||||||
Poll::Pending => {
|
|
||||||
cx.waker().wake_by_ref();
|
|
||||||
Poll::Pending
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user