io: remove erroneous wake call in SinkWriter (#5436)

This commit is contained in:
Dmitry Ivanov
2023-02-07 18:32:27 +00:00
committed by GitHub
parent abf5d28f2c
commit 5653b4583c
+6 -13
View File
@@ -1,3 +1,4 @@
use futures_core::ready;
use futures_sink::Sink;
use pin_project_lite::pin_project;
@@ -98,19 +99,11 @@ where
buf: &[u8],
) -> Poll<Result<usize, io::Error>> {
let mut this = self.project();
match this.inner.as_mut().poll_ready(cx) {
Poll::Ready(Ok(())) => {
if let Err(e) = this.inner.as_mut().start_send(buf) {
Poll::Ready(Err(e.into()))
} else {
Poll::Ready(Ok(buf.len()))
}
}
Poll::Ready(Err(e)) => Poll::Ready(Err(e.into())),
Poll::Pending => {
cx.waker().wake_by_ref();
Poll::Pending
}
ready!(this.inner.as_mut().poll_ready(cx).map_err(Into::into))?;
match this.inner.as_mut().start_send(buf) {
Ok(()) => Poll::Ready(Ok(buf.len())),
Err(e) => Poll::Ready(Err(e.into())),
}
}