1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-28 05:10:36 +02:00

better Connector impl

This commit is contained in:
Nikolay Kim
2018-08-28 16:24:36 -07:00
parent 6ec5e958ac
commit 10d2c67596
4 changed files with 98 additions and 59 deletions

View File

@ -64,14 +64,16 @@ fn main() {
// bind socket address and start workers. By default server uses number of
// available logical cpu as threads count. actix net start separate
// instances of service pipeline in each worker.
Server::default().bind(
// configure service pipeline
"0.0.0.0:8443", move || {
let num = num.clone();
let acceptor = acceptor.clone();
Server::default()
.bind(
// configure service pipeline
"0.0.0.0:8443",
move || {
let num = num.clone();
let acceptor = acceptor.clone();
// service for converting incoming TcpStream to a SslStream<TcpStream>
(move |stream| {
// service for converting incoming TcpStream to a SslStream<TcpStream>
(move |stream| {
SslAcceptorExt::accept_async(&acceptor, stream)
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
})
@ -89,7 +91,9 @@ fn main() {
.and_then((service, move || {
Ok::<_, io::Error>(ServiceState { num: num.clone() })
}))
}).unwrap().start();
},
).unwrap()
.start();
sys.run();
}