mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 17:41:11 +00:00
Re-use tcp listener on pause/resume
This commit is contained in:
parent
483db7028c
commit
285c73e95e
3 changed files with 7 additions and 15 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
* Fix scope resource path extractor #234
|
||||
|
||||
* Re-use tcp listener on pause/resume
|
||||
|
||||
|
||||
## 0.6.7 (2018-05-17)
|
||||
|
||||
|
|
|
@ -450,7 +450,6 @@ impl<H: IntoHttpHandler> HttpServer<H> {
|
|||
self.accept.push(start_accept_thread(
|
||||
token,
|
||||
sock,
|
||||
self.backlog,
|
||||
tx.clone(),
|
||||
socks.clone(),
|
||||
workers.clone(),
|
||||
|
@ -782,7 +781,7 @@ enum Command {
|
|||
}
|
||||
|
||||
fn start_accept_thread(
|
||||
token: usize, sock: Socket, backlog: i32, srv: mpsc::UnboundedSender<ServerCommand>,
|
||||
token: usize, sock: Socket, srv: mpsc::UnboundedSender<ServerCommand>,
|
||||
socks: Slab<SocketInfo>,
|
||||
mut workers: Vec<(usize, mpsc::UnboundedSender<Conn<net::TcpStream>>)>,
|
||||
) -> (mio::SetReadiness, sync_mpsc::Sender<Command>) {
|
||||
|
@ -892,8 +891,8 @@ fn start_accept_thread(
|
|||
},
|
||||
CMD => match rx.try_recv() {
|
||||
Ok(cmd) => match cmd {
|
||||
Command::Pause => if let Some(server) = server.take() {
|
||||
if let Err(err) = poll.deregister(&server) {
|
||||
Command::Pause => if let Some(ref server) = server {
|
||||
if let Err(err) = poll.deregister(server) {
|
||||
error!(
|
||||
"Can not deregister server socket {}",
|
||||
err
|
||||
|
@ -906,15 +905,6 @@ fn start_accept_thread(
|
|||
}
|
||||
},
|
||||
Command::Resume => {
|
||||
let lst = create_tcp_listener(addr, backlog)
|
||||
.expect("Can not create net::TcpListener");
|
||||
|
||||
server = Some(
|
||||
mio::net::TcpListener::from_std(lst).expect(
|
||||
"Can not create mio::net::TcpListener",
|
||||
),
|
||||
);
|
||||
|
||||
if let Some(ref server) = server {
|
||||
if let Err(err) = poll.register(
|
||||
server,
|
||||
|
|
|
@ -239,9 +239,9 @@ impl StreamHandlerType {
|
|||
match *self {
|
||||
StreamHandlerType::Normal => "http",
|
||||
#[cfg(feature = "tls")]
|
||||
StreamHandlerType::Tls(ref acceptor) => "https",
|
||||
StreamHandlerType::Tls(_) => "https",
|
||||
#[cfg(feature = "alpn")]
|
||||
StreamHandlerType::Alpn(ref acceptor) => "https",
|
||||
StreamHandlerType::Alpn(_) => "https",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue