mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +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
+3
-4
@@ -31,7 +31,7 @@ use futures::stream::{self, Stream};
|
||||
use futures_cpupool::CpuPool;
|
||||
use tokio_io::IoFuture;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::reactor::Reactor;
|
||||
use tokio::reactor::Handle;
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
@@ -40,8 +40,7 @@ fn main() {
|
||||
|
||||
let pool = CpuPool::new(1);
|
||||
|
||||
let mut core = Reactor::new().unwrap();
|
||||
let handle = core.handle();
|
||||
let handle = Handle::default();
|
||||
let socket = TcpListener::bind(&addr, &handle).unwrap();
|
||||
println!("Listening on: {}", addr);
|
||||
let server = socket.incoming().for_each(|(socket, addr)| {
|
||||
@@ -49,7 +48,7 @@ fn main() {
|
||||
pool.execute(write(socket).or_else(|_| Ok(()))).unwrap();
|
||||
Ok(())
|
||||
});
|
||||
core.run(server).unwrap();
|
||||
server.wait().unwrap();
|
||||
}
|
||||
|
||||
fn write(socket: TcpStream) -> IoFuture<()> {
|
||||
|
||||
Reference in New Issue
Block a user