mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
Fixed panic during graceful shutdown
This commit is contained in:
parent
c3ad516f56
commit
65e9201b4d
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [0.7.10] - 2018-10-09
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed panic during graceful shutdown
|
||||
|
||||
|
||||
## [0.7.9] - 2018-10-09
|
||||
|
||||
### Added
|
||||
|
@ -9,7 +9,7 @@ use tokio_reactor::Handle;
|
||||
use tokio_tcp::TcpStream;
|
||||
use tokio_timer::{sleep, Delay};
|
||||
|
||||
use super::channel::HttpProtocol;
|
||||
// use super::channel::HttpProtocol;
|
||||
use super::error::AcceptorError;
|
||||
use super::handler::HttpHandler;
|
||||
use super::settings::ServiceConfig;
|
||||
@ -367,9 +367,9 @@ where
|
||||
}
|
||||
ServerMessage::Shutdown(_) => Either::B(ok(())),
|
||||
ServerMessage::ForceShutdown => {
|
||||
self.settings
|
||||
.head()
|
||||
.traverse(|proto: &mut HttpProtocol<TcpStream, H>| proto.shutdown());
|
||||
// self.settings
|
||||
// .head()
|
||||
// .traverse(|proto: &mut HttpProtocol<TcpStream, H>| proto.shutdown());
|
||||
Either::B(ok(()))
|
||||
}
|
||||
}
|
||||
|
@ -20,23 +20,23 @@ pub(crate) enum HttpProtocol<T: IoStream, H: HttpHandler + 'static> {
|
||||
None,
|
||||
}
|
||||
|
||||
impl<T: IoStream, H: HttpHandler + 'static> HttpProtocol<T, H> {
|
||||
pub(crate) fn shutdown(&mut self) {
|
||||
match self {
|
||||
HttpProtocol::H1(ref mut h1) => {
|
||||
let io = h1.io();
|
||||
let _ = IoStream::set_linger(io, Some(time::Duration::new(0, 0)));
|
||||
let _ = IoStream::shutdown(io, Shutdown::Both);
|
||||
}
|
||||
HttpProtocol::H2(ref mut h2) => h2.shutdown(),
|
||||
HttpProtocol::Unknown(_, io, _) => {
|
||||
let _ = IoStream::set_linger(io, Some(time::Duration::new(0, 0)));
|
||||
let _ = IoStream::shutdown(io, Shutdown::Both);
|
||||
}
|
||||
HttpProtocol::None => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
// impl<T: IoStream, H: HttpHandler + 'static> HttpProtocol<T, H> {
|
||||
// fn shutdown_(&mut self) {
|
||||
// match self {
|
||||
// HttpProtocol::H1(ref mut h1) => {
|
||||
// let io = h1.io();
|
||||
// let _ = IoStream::set_linger(io, Some(time::Duration::new(0, 0)));
|
||||
// let _ = IoStream::shutdown(io, Shutdown::Both);
|
||||
// }
|
||||
// HttpProtocol::H2(ref mut h2) => h2.shutdown(),
|
||||
// HttpProtocol::Unknown(_, io, _) => {
|
||||
// let _ = IoStream::set_linger(io, Some(time::Duration::new(0, 0)));
|
||||
// let _ = IoStream::shutdown(io, Shutdown::Both);
|
||||
// }
|
||||
// HttpProtocol::None => (),
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
enum ProtocolKind {
|
||||
Http1,
|
||||
|
Loading…
Reference in New Issue
Block a user