Skip to content

Commit

Permalink
futures: fix sink usage
Browse files Browse the repository at this point in the history
when start_send returns NotReady you're supposed to call poll_complete before bubbling that up

Signed-off-by: Marc-Antoine Perennou <[email protected]>
  • Loading branch information
Keruspe committed Jun 25, 2018
1 parent 9c69fea commit b818665
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions futures/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl<T> AMQPTransport<T>

/// Poll the network to send outcoming frames.
fn poll_send(&mut self) -> Poll<(), io::Error> {
let mut ret = Ok(Async::Ready(()));
while let Some(frame) = self.conn.next_frame() {
trace!("transport poll_send; frame={:?}", frame);
match self.start_send(frame)? {
Expand All @@ -204,11 +205,16 @@ impl<T> AMQPTransport<T>
AsyncSink::NotReady(frame) => {
trace!("transport poll_send; status=NotReady");
self.conn.frame_queue.push_front(frame);
return Ok(Async::NotReady);
ret = Ok(Async::NotReady);
break;
}
}
}
self.poll_complete()
if self.poll_complete()?.is_ready() {
ret
} else {
Ok(Async::NotReady)
}
}
}

Expand Down

0 comments on commit b818665

Please sign in to comment.