Fix README future service examples

This commit is contained in:
Tim Kuehn
2017-02-16 12:07:49 -08:00
parent 15f83961e9
commit fc2edc89af

View File

@@ -125,12 +125,13 @@ impl FutureService for HelloServer {
}
fn main() {
let mut core = reactor::Core::new().unwrap();
let mut reactor = reactor::Core::new().unwrap();
let addr = HelloServer.listen("localhost:10000".first_socket_addr(),
server::Options::from(core.handle()))
&reactor.handle(),
server::Options::default())
.unwrap();
let options = client::Options::default().handle(core.handle());
core.run(FutureClient::connect(addr, options)
let options = client::Options::default().handle(reactor.handle());
reactor.run(FutureClient::connect(addr, options)
.map_err(tarpc::Error::from)
.and_then(|client| client.hello("Mom".to_string()))
.map(|resp| println!("{}", resp)))
@@ -201,16 +202,16 @@ fn get_acceptor() -> TlsAcceptor {
}
fn main() {
let mut core = reactor::Core::new().unwrap();
let mut reactor = reactor::Core::new().unwrap();
let acceptor = get_acceptor();
let addr = HelloServer.listen("localhost:10000".first_socket_addr(),
server::Options::from(core.handle())
.tls(acceptor))
&reactor.handle(),
server::Options::default().tls(acceptor))
.unwrap();
let options = client::Options::default()
.handle(core.handle())
.handle(reactor.handle())
.tls(client::tls::Context::new("foobar.com").unwrap()));
core.run(FutureClient::connect(addr, options)
reactor.run(FutureClient::connect(addr, options)
.map_err(tarpc::Error::from)
.and_then(|client| client.hello("Mom".to_string()))
.map(|resp| println!("{}", resp)))