summaryrefslogtreecommitdiffstats
path: root/examples/echo.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-12-12 18:32:50 -0600
committerCarl Lerche <me@carllerche.com>2017-12-12 18:32:50 -0600
commit4ef772b2db9fdf19625e428f1031409994b4c8e6 (patch)
tree35d3bd529eedbab426130edde1c9dbc71ff5d80f /examples/echo.rs
parent849771ecfa1e22fdd4f0bd299d10f0026ce14ed5 (diff)
Remove `Handle` argument from I/O constructors (#61)
This commit removes the `Handle` argument from the following constructors * `TcpListener::bind` * `TcpStream::connect` * `UdpSocket::bind` The `Handle` argument remains on the various `*_std` constructors as they're more low-level, but this otherwise is intended to set forth a precedent of by default not taking `Handle` arguments and instead relying on the global `Handle::default` return value when necesary.
Diffstat (limited to 'examples/echo.rs')
-rw-r--r--examples/echo.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/echo.rs b/examples/echo.rs
index ca081f84..f7219113 100644
--- a/examples/echo.rs
+++ b/examples/echo.rs
@@ -32,7 +32,6 @@ use futures_cpupool::CpuPool;
use tokio_io::AsyncRead;
use tokio_io::io::copy;
use tokio::net::TcpListener;
-use tokio::reactor::Handle;
fn main() {
// Allow passing an address to listen on as the first argument of this
@@ -41,14 +40,12 @@ fn main() {
let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string());
let addr = addr.parse::<SocketAddr>().unwrap();
- let handle = Handle::default();
-
// Next up we create a TCP listener which will listen for incoming
// connections. This TCP listener is bound to the address we determined
// above and must be associated with an event loop, so we pass in a handle
// to our event loop. After the socket's created we inform that we're ready
// to go and start accepting connections.
- let socket = TcpListener::bind(&addr, &handle).unwrap();
+ let socket = TcpListener::bind(&addr).unwrap();
println!("Listening on: {}", addr);
// A CpuPool allows futures to be executed concurrently.