1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01:00

update all features

This commit is contained in:
Nikolay Kim 2018-03-07 21:37:42 -08:00
parent 77a111b95c
commit ffb89935b6

View File

@ -363,15 +363,20 @@ impl<H: IntoHttpHandler> HttpServer<H>
if self.sockets.is_empty() { if self.sockets.is_empty() {
Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound")) Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound"))
} else { } else {
let (tx, rx) = mpsc::unbounded();
let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect(); let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect();
let settings = ServerSettings::new(Some(addrs[0].0), &self.host, false); let settings = ServerSettings::new(Some(addrs[0].0), &self.host, false);
let workers = self.start_workers(&settings, &StreamHandlerType::Tls(acceptor)); let workers = self.start_workers(
&settings, &StreamHandlerType::Tls(acceptor.clone()));
let info = Info{addr: addrs[0].0, handler: StreamHandlerType::Tls(acceptor)};
// start acceptors threads // start acceptors threads
for (addr, sock) in addrs { for (addr, sock) in addrs {
info!("Starting server on https://{}", addr); info!("Starting server on https://{}", addr);
self.accept.push( self.accept.push(
start_accept_thread(sock, addr, self.backlog, workers.clone())); start_accept_thread(
sock, addr, self.backlog,
tx.clone(), info.clone(), workers.clone()));
} }
// start http server actor // start http server actor
@ -409,16 +414,21 @@ impl<H: IntoHttpHandler> HttpServer<H>
} }
}); });
let (tx, rx) = mpsc::unbounded();
let acceptor = builder.build(); let acceptor = builder.build();
let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect(); let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect();
let settings = ServerSettings::new(Some(addrs[0].0), &self.host, false); let settings = ServerSettings::new(Some(addrs[0].0), &self.host, false);
let workers = self.start_workers(&settings, &StreamHandlerType::Alpn(acceptor)); let workers = self.start_workers(
&settings, &StreamHandlerType::Alpn(acceptor.clone()));
let info = Info{addr: addrs[0].0, handler: StreamHandlerType::Alpn(acceptor)};
// start acceptors threads // start acceptors threads
for (addr, sock) in addrs { for (addr, sock) in addrs {
info!("Starting server on https://{}", addr); info!("Starting server on https://{}", addr);
self.accept.push( self.accept.push(
start_accept_thread(sock, addr, self.backlog, workers.clone())); start_accept_thread(
sock, addr, self.backlog,
tx.clone(), info.clone(), workers.clone()));
} }
// start http server actor // start http server actor