mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-03 00:00:05 +02:00
Remove the Reactor::run method (#58)
This commit removes the `Reactor::run` method which has previously been used to execute futures and turn the reactor at the same time. The tests/examples made heavy usage of this method but they have now all temporarily moved to `wait()` until the futures dependency is upgraded. In the meantime this'll allow us to further trim down the `Reactor` APIs to their final state.
This commit is contained in:
committed by
Carl Lerche
parent
32f2750c2d
commit
a577bfc033
+5
-5
@@ -19,17 +19,17 @@ extern crate tokio_io;
|
||||
use std::env;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use futures::stream::Stream;
|
||||
use tokio::reactor::Reactor;
|
||||
use futures::prelude::*;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::reactor::Handle;
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string());
|
||||
let addr = addr.parse::<SocketAddr>().unwrap();
|
||||
|
||||
let mut core = Reactor::new().unwrap();
|
||||
let listener = TcpListener::bind(&addr, &core.handle()).unwrap();
|
||||
let handle = Handle::default();
|
||||
let listener = TcpListener::bind(&addr, &handle).unwrap();
|
||||
|
||||
let addr = listener.local_addr().unwrap();
|
||||
println!("Listening for connections on {}", addr);
|
||||
@@ -42,5 +42,5 @@ fn main() {
|
||||
Ok(())
|
||||
});
|
||||
|
||||
core.run(server).unwrap();
|
||||
server.wait().unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user