mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-21 10:38:26 +01:00
Fix README future service examples
This commit is contained in:
19
README.md
19
README.md
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user