diff options
author | Carl Lerche <me@carllerche.com> | 2018-03-04 10:46:54 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-04 10:46:54 -0800 |
commit | 9f7a98af3c4cbeb89b162c1faa4480553a3dc82e (patch) | |
tree | 13ba7eb34d118e32c40f9775592665b8ebe9bc9c /examples/echo-udp.rs | |
parent | 7db77194194851fcc7cad4d68f0481941fb8a285 (diff) |
Switch TCP/UDP fns to poll_ -> Poll<...> style (#175)
Tokio is moving away from using `WouldBlock`, instead favoring
`Async::NotReady`.
This patch updates the TCP and UDP types, deprecating any function that
returns `WouldBlock` and adding a poll_ prefixed equivalent.
Diffstat (limited to 'examples/echo-udp.rs')
-rw-r--r-- | examples/echo-udp.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/echo-udp.rs b/examples/echo-udp.rs index f7e2bf09..18f2d393 100644 --- a/examples/echo-udp.rs +++ b/examples/echo-udp.rs @@ -10,9 +10,9 @@ //! //! Each line you type in to the `nc` terminal should be echo'd back to you! +#[macro_use] extern crate futures; extern crate tokio; -#[macro_use] extern crate tokio_io; use std::{env, io}; @@ -37,14 +37,14 @@ impl Future for Server { // If so then we try to send it back to the original source, waiting // until it's writable and we're able to do so. if let Some((size, peer)) = self.to_send { - let amt = try_nb!(self.socket.send_to(&self.buf[..size], &peer)); + let amt = try_ready!(self.socket.poll_send_to(&self.buf[..size], &peer)); println!("Echoed {}/{} bytes to {}", amt, size, peer); self.to_send = None; } // If we're here then `to_send` is `None`, so we take a look for the // next message we're going to echo back. - self.to_send = Some(try_nb!(self.socket.recv_from(&mut self.buf))); + self.to_send = Some(try_ready!(self.socket.poll_recv_from(&mut self.buf))); } } } |