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