mirror of
https://github.com/actix/actix-web.git
synced 2024-11-26 11:31:09 +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
|
* Fix scope resource path extractor #234
|
||||||
|
|
||||||
|
* Re-use tcp listener on pause/resume
|
||||||
|
|
||||||
|
|
||||||
## 0.6.7 (2018-05-17)
|
## 0.6.7 (2018-05-17)
|
||||||
|
|
||||||
|
|
|
@ -450,7 +450,6 @@ impl<H: IntoHttpHandler> HttpServer<H> {
|
||||||
self.accept.push(start_accept_thread(
|
self.accept.push(start_accept_thread(
|
||||||
token,
|
token,
|
||||||
sock,
|
sock,
|
||||||
self.backlog,
|
|
||||||
tx.clone(),
|
tx.clone(),
|
||||||
socks.clone(),
|
socks.clone(),
|
||||||
workers.clone(),
|
workers.clone(),
|
||||||
|
@ -782,7 +781,7 @@ enum Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_accept_thread(
|
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>,
|
socks: Slab<SocketInfo>,
|
||||||
mut workers: Vec<(usize, mpsc::UnboundedSender<Conn<net::TcpStream>>)>,
|
mut workers: Vec<(usize, mpsc::UnboundedSender<Conn<net::TcpStream>>)>,
|
||||||
) -> (mio::SetReadiness, sync_mpsc::Sender<Command>) {
|
) -> (mio::SetReadiness, sync_mpsc::Sender<Command>) {
|
||||||
|
@ -892,8 +891,8 @@ fn start_accept_thread(
|
||||||
},
|
},
|
||||||
CMD => match rx.try_recv() {
|
CMD => match rx.try_recv() {
|
||||||
Ok(cmd) => match cmd {
|
Ok(cmd) => match cmd {
|
||||||
Command::Pause => if let Some(server) = server.take() {
|
Command::Pause => if let Some(ref server) = server {
|
||||||
if let Err(err) = poll.deregister(&server) {
|
if let Err(err) = poll.deregister(server) {
|
||||||
error!(
|
error!(
|
||||||
"Can not deregister server socket {}",
|
"Can not deregister server socket {}",
|
||||||
err
|
err
|
||||||
|
@ -906,15 +905,6 @@ fn start_accept_thread(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Command::Resume => {
|
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 Some(ref server) = server {
|
||||||
if let Err(err) = poll.register(
|
if let Err(err) = poll.register(
|
||||||
server,
|
server,
|
||||||
|
|
|
@ -239,9 +239,9 @@ impl StreamHandlerType {
|
||||||
match *self {
|
match *self {
|
||||||
StreamHandlerType::Normal => "http",
|
StreamHandlerType::Normal => "http",
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
StreamHandlerType::Tls(ref acceptor) => "https",
|
StreamHandlerType::Tls(_) => "https",
|
||||||
#[cfg(feature = "alpn")]
|
#[cfg(feature = "alpn")]
|
||||||
StreamHandlerType::Alpn(ref acceptor) => "https",
|
StreamHandlerType::Alpn(_) => "https",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue