From ffb89935b60feecf9d4455d5577c4ef9f5f6f9a9 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Wed, 7 Mar 2018 21:37:42 -0800 Subject: [PATCH] update all features --- src/server/srv.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/server/srv.rs b/src/server/srv.rs index 2b3cbae62..cd6e2edfe 100644 --- a/src/server/srv.rs +++ b/src/server/srv.rs @@ -363,15 +363,20 @@ impl HttpServer if self.sockets.is_empty() { Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound")) } else { + let (tx, rx) = mpsc::unbounded(); let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect(); 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 for (addr, sock) in addrs { info!("Starting server on https://{}", addr); 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 @@ -409,16 +414,21 @@ impl HttpServer } }); + let (tx, rx) = mpsc::unbounded(); let acceptor = builder.build(); let addrs: Vec<(net::SocketAddr, net::TcpListener)> = self.sockets.drain().collect(); 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 for (addr, sock) in addrs { info!("Starting server on https://{}", addr); 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