diff options
author | Alex Crichton <alex@alexcrichton.com> | 2017-12-11 21:29:18 -0600 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2017-12-11 21:29:18 -0600 |
commit | a577bfc033b50c913c2241c432bcaeac3917145c (patch) | |
tree | 1151bc60d9f9373722d6bea9127b965a4db470bc /examples/proxy.rs | |
parent | 32f2750c2d99e82d64033c5865d2f4e029cb31ac (diff) |
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.
Diffstat (limited to 'examples/proxy.rs')
-rw-r--r-- | examples/proxy.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/proxy.rs b/examples/proxy.rs index 9d77c54f..03a83204 100644 --- a/examples/proxy.rs +++ b/examples/proxy.rs @@ -31,7 +31,7 @@ use futures::{Future, Poll}; use futures::future::Executor; use futures_cpupool::CpuPool; use tokio::net::{TcpListener, TcpStream}; -use tokio::reactor::Reactor; +use tokio::reactor::Handle; use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::io::{copy, shutdown}; @@ -42,14 +42,12 @@ fn main() { let server_addr = env::args().nth(2).unwrap_or("127.0.0.1:8080".to_string()); let server_addr = server_addr.parse::<SocketAddr>().unwrap(); - // Create the event loop that will drive this server. - let mut l = Reactor::new().unwrap(); - let handle = l.handle(); + let handle = Handle::default(); let pool = CpuPool::new(1); // Create a TCP listener which will listen for incoming connections. - let socket = TcpListener::bind(&listen_addr, &l.handle()).unwrap(); + let socket = TcpListener::bind(&listen_addr, &handle).unwrap(); println!("Listening on: {}", listen_addr); println!("Proxying to: {}", server_addr); @@ -97,7 +95,7 @@ fn main() { Ok(()) }); - l.run(done).unwrap(); + done.wait().unwrap(); } // This is a custom type used to have a custom implementation of the |