Skip to content

Commit

Permalink
Flush needs to register listener too
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo committed Dec 29, 2019
1 parent 24b4f1b commit 8ccdfd2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/utils/io/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,16 @@ where

fn poll_flush(
mut self: Pin<&mut Self>,
_cx: &mut task::Context<'_>,
cx: &mut task::Context<'_>,
) -> Poll<Result<(), Self::Error>> {
unsafe { self.get_unchecked_mut() }.flush()
let writer = unsafe { self.get_unchecked_mut() };
match writer.flush() {
Poll::Pending => {
writer.listen(cx.waker().clone());
Poll::Pending
}
Poll::Ready(out) => Poll::Ready(out),
}
}

fn poll_close(
Expand Down

0 comments on commit 8ccdfd2

Please sign in to comment.