client: stream.poll_complete() for ease of use

This commit is contained in:
Astro 2017-08-24 20:10:58 +02:00
commit 58b5a84391
4 changed files with 24 additions and 20 deletions

View file

@ -92,6 +92,15 @@ impl Stream for Component {
}
},
ComponentState::Connected(mut stream) => {
// Poll sink
match stream.poll_complete() {
Ok(Async::NotReady) => (),
Ok(Async::Ready(())) => (),
Err(e) =>
return Err(e.description().to_owned()),
};
// Poll stream
match stream.poll() {
Ok(Async::NotReady) => {
self.state = ComponentState::Connected(stream);