mirror of
https://github.com/actix/actix-web.git
synced 2024-12-27 10:30:33 +00:00
fix keep-alive timer reset
This commit is contained in:
parent
8e354021d4
commit
2677d325a7
4 changed files with 35 additions and 13 deletions
|
@ -1,16 +1,21 @@
|
|||
# Changes
|
||||
|
||||
## [0.7.14] - 2018-10-x
|
||||
## [0.7.14] - 2018-11-x
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fix keep-alive timer reset
|
||||
|
||||
* HttpServer now treats streaming bodies the same for HTTP/1.x protocols. #549
|
||||
|
||||
|
||||
### Added
|
||||
|
||||
* Add method to configure custom error handler to `Query` and `Path` extractors.
|
||||
|
||||
* Add method to configure `SameSite` option in `CookieIdentityPolicy`.
|
||||
|
||||
|
||||
## [0.7.13] - 2018-10-14
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "actix-web"
|
||||
version = "0.7.13"
|
||||
version = "0.7.14"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||
readme = "README.md"
|
||||
|
|
|
@ -87,7 +87,10 @@ where
|
|||
H: HttpHandler + 'static,
|
||||
{
|
||||
pub fn new(
|
||||
settings: ServiceConfig<H>, stream: T, buf: BytesMut, is_eof: bool,
|
||||
settings: ServiceConfig<H>,
|
||||
stream: T,
|
||||
buf: BytesMut,
|
||||
is_eof: bool,
|
||||
keepalive_timer: Option<Delay>,
|
||||
) -> Self {
|
||||
let addr = stream.peer_addr();
|
||||
|
@ -123,8 +126,11 @@ where
|
|||
}
|
||||
|
||||
pub(crate) fn for_error(
|
||||
settings: ServiceConfig<H>, stream: T, status: StatusCode,
|
||||
mut keepalive_timer: Option<Delay>, buf: BytesMut,
|
||||
settings: ServiceConfig<H>,
|
||||
stream: T,
|
||||
status: StatusCode,
|
||||
mut keepalive_timer: Option<Delay>,
|
||||
buf: BytesMut,
|
||||
) -> Self {
|
||||
if let Some(deadline) = settings.client_timer_expire() {
|
||||
let _ = keepalive_timer.as_mut().map(|delay| delay.reset(deadline));
|
||||
|
@ -298,16 +304,19 @@ where
|
|||
if let Some(deadline) =
|
||||
self.settings.client_shutdown_timer()
|
||||
{
|
||||
timer.reset(deadline)
|
||||
timer.reset(deadline);
|
||||
let _ = timer.poll();
|
||||
} else {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
} else if let Some(dl) = self.settings.keep_alive_expire() {
|
||||
timer.reset(dl)
|
||||
timer.reset(dl);
|
||||
let _ = timer.poll();
|
||||
}
|
||||
} else {
|
||||
timer.reset(self.ka_expire)
|
||||
timer.reset(self.ka_expire);
|
||||
let _ = timer.poll();
|
||||
}
|
||||
}
|
||||
Ok(Async::NotReady) => (),
|
||||
|
|
|
@ -60,7 +60,10 @@ where
|
|||
H: HttpHandler + 'static,
|
||||
{
|
||||
pub fn new(
|
||||
settings: ServiceConfig<H>, io: T, buf: Bytes, keepalive_timer: Option<Delay>,
|
||||
settings: ServiceConfig<H>,
|
||||
io: T,
|
||||
buf: Bytes,
|
||||
keepalive_timer: Option<Delay>,
|
||||
) -> Self {
|
||||
let addr = io.peer_addr();
|
||||
let extensions = io.extensions();
|
||||
|
@ -284,10 +287,12 @@ where
|
|||
if self.tasks.is_empty() {
|
||||
return Err(HttpDispatchError::ShutdownTimeout);
|
||||
} else if let Some(dl) = self.settings.keep_alive_expire() {
|
||||
timer.reset(dl)
|
||||
timer.reset(dl);
|
||||
let _ = timer.poll();
|
||||
}
|
||||
} else {
|
||||
timer.reset(self.ka_expire)
|
||||
timer.reset(self.ka_expire);
|
||||
let _ = timer.poll();
|
||||
}
|
||||
}
|
||||
Ok(Async::NotReady) => (),
|
||||
|
@ -348,8 +353,11 @@ struct Entry<H: HttpHandler + 'static> {
|
|||
|
||||
impl<H: HttpHandler + 'static> Entry<H> {
|
||||
fn new(
|
||||
parts: Parts, recv: RecvStream, resp: SendResponse<Bytes>,
|
||||
addr: Option<SocketAddr>, settings: ServiceConfig<H>,
|
||||
parts: Parts,
|
||||
recv: RecvStream,
|
||||
resp: SendResponse<Bytes>,
|
||||
addr: Option<SocketAddr>,
|
||||
settings: ServiceConfig<H>,
|
||||
extensions: Option<Rc<Extensions>>,
|
||||
) -> Entry<H>
|
||||
where
|
||||
|
|
Loading…
Reference in a new issue