aboutsummaryrefslogtreecommitdiffstats
path: root/src/server.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/server.rs b/src/server.rs
index 45f5a4b..9b48381 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -853,23 +853,18 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
}
Err(e) => classify_connection_error(e),
},
- Some(ReadSocket::Processing(_, fut)) => match fut.poll()? {
- futures::Async::Ready((state, msg)) => {
- if let Some(ReadSocket::Processing(s, _)) =
- conn.rsock.take()
- {
- conn.state = state;
- conn.send_message(msg);
- conn.rsock = Some(ReadSocket::Connected(s));
- } else {
- unreachable!()
- }
- Ok(crate::component_future::Async::DidWork)
- }
- futures::Async::NotReady => {
- Ok(crate::component_future::Async::NotReady)
+ Some(ReadSocket::Processing(_, fut)) => {
+ let (state, msg) = try_ready!(fut.poll());
+ if let Some(ReadSocket::Processing(s, _)) = conn.rsock.take()
+ {
+ conn.state = state;
+ conn.send_message(msg);
+ conn.rsock = Some(ReadSocket::Connected(s));
+ } else {
+ unreachable!()
}
- },
+ Ok(crate::component_future::Async::DidWork)
+ }
_ => Ok(crate::component_future::Async::NothingToDo),
}
}
@@ -961,15 +956,11 @@ impl<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
fn poll_new_connections(
&mut self,
) -> crate::component_future::Poll<(), Error> {
- match self.sock_stream.poll()? {
- futures::Async::Ready(Some(conn)) => {
- self.connections.insert(conn.id.to_string(), conn);
- Ok(crate::component_future::Async::DidWork)
- }
- futures::Async::Ready(None) => Err(Error::SocketChannelClosed),
- futures::Async::NotReady => {
- Ok(crate::component_future::Async::NotReady)
- }
+ if let Some(conn) = try_ready!(self.sock_stream.poll()) {
+ self.connections.insert(conn.id.to_string(), conn);
+ Ok(crate::component_future::Async::DidWork)
+ } else {
+ Err(Error::SocketChannelClosed)
}
}