From bbcd618304e7bee84413fbb74df70910e21b41ca Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 2 Oct 2018 19:12:08 -0700 Subject: [PATCH] export AcceptorTimeout --- src/server/acceptor.rs | 12 ++++++++---- src/server/mod.rs | 3 +++ src/server/settings.rs | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/server/acceptor.rs b/src/server/acceptor.rs index 79d133d2d..f66e51dbe 100644 --- a/src/server/acceptor.rs +++ b/src/server/acceptor.rs @@ -172,10 +172,11 @@ where } } +#[doc(hidden)] /// Acceptor timeout middleware /// /// Applies timeout to request prcoessing. -pub(crate) struct AcceptorTimeout { +pub struct AcceptorTimeout { inner: T, timeout: Duration, } @@ -206,7 +207,7 @@ impl NewService for AcceptorTimeout { } #[doc(hidden)] -pub(crate) struct AcceptorTimeoutFut { +pub struct AcceptorTimeoutFut { fut: T::Future, timeout: Duration, } @@ -224,10 +225,11 @@ impl Future for AcceptorTimeoutFut { } } +#[doc(hidden)] /// Acceptor timeout service /// /// Applies timeout to request prcoessing. -pub(crate) struct AcceptorTimeoutService { +pub struct AcceptorTimeoutService { inner: T, timeout: Duration, } @@ -250,10 +252,12 @@ impl Service for AcceptorTimeoutService { } } -pub(crate) struct AcceptorTimeoutResponse { +#[doc(hidden)] +pub struct AcceptorTimeoutResponse { fut: T::Future, sleep: Delay, } + impl Future for AcceptorTimeoutResponse { type Item = T::Response; type Error = AcceptorError; diff --git a/src/server/mod.rs b/src/server/mod.rs index c942ff91f..3277dba5a 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -145,6 +145,9 @@ pub use self::ssl::*; pub use self::error::{AcceptorError, HttpDispatchError}; pub use self::settings::ServerSettings; +#[doc(hidden)] +pub use self::acceptor::AcceptorTimeout; + #[doc(hidden)] pub use self::settings::{ServiceConfig, ServiceConfigBuilder}; diff --git a/src/server/settings.rs b/src/server/settings.rs index 3798fae50..9b27ed5e5 100644 --- a/src/server/settings.rs +++ b/src/server/settings.rs @@ -282,7 +282,7 @@ impl ServiceConfig { // periodic date update let s = self.clone(); - spawn(sleep(Duration::from_secs(1)).then(move |_| { + spawn(sleep(Duration::from_millis(500)).then(move |_| { s.update_date(); future::ok(()) })); @@ -310,7 +310,7 @@ impl ServiceConfig { // periodic date update let s = self.clone(); - spawn(sleep(Duration::from_secs(1)).then(move |_| { + spawn(sleep(Duration::from_millis(500)).then(move |_| { s.update_date(); future::ok(()) }));