mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
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.
This commit is contained in:
committed by
Carl Lerche
parent
849771ecfa
commit
4ef772b2db
@@ -30,7 +30,6 @@ use futures_cpupool::CpuPool;
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_io::io::copy;
|
||||
use tokio::net::{TcpStream, TcpListener};
|
||||
use tokio::reactor::Handle;
|
||||
|
||||
fn main() {
|
||||
// First argument, the address to bind
|
||||
@@ -41,8 +40,7 @@ fn main() {
|
||||
let num_threads = env::args().nth(2).and_then(|s| s.parse().ok())
|
||||
.unwrap_or(num_cpus::get());
|
||||
|
||||
let handle = Handle::default();
|
||||
let listener = TcpListener::bind(&addr, &handle).expect("failed to bind");
|
||||
let listener = TcpListener::bind(&addr).expect("failed to bind");
|
||||
println!("Listening on: {}", addr);
|
||||
|
||||
// Spin up our worker threads, creating a channel routing to each worker
|
||||
|
||||
Reference in New Issue
Block a user