mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
export set_date
This commit is contained in:
parent
6c3d8b8738
commit
f8af3b86e5
@ -158,7 +158,8 @@ impl ServiceConfig {
|
|||||||
self.0.timer.now()
|
self.0.timer.now()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_date(&self, dst: &mut BytesMut) {
|
#[doc(hidden)]
|
||||||
|
pub fn set_date(&self, dst: &mut BytesMut) {
|
||||||
let mut buf: [u8; 39] = [0; 39];
|
let mut buf: [u8; 39] = [0; 39];
|
||||||
buf[..6].copy_from_slice(b"date: ");
|
buf[..6].copy_from_slice(b"date: ");
|
||||||
buf[6..35].copy_from_slice(&self.0.timer.date().bytes);
|
buf[6..35].copy_from_slice(&self.0.timer.date().bytes);
|
||||||
|
@ -31,7 +31,7 @@ const AVERAGE_HEADER_SIZE: usize = 30;
|
|||||||
|
|
||||||
/// HTTP/1 Codec
|
/// HTTP/1 Codec
|
||||||
pub struct Codec {
|
pub struct Codec {
|
||||||
pub(crate) config: ServiceConfig,
|
config: ServiceConfig,
|
||||||
decoder: decoder::MessageDecoder<Request>,
|
decoder: decoder::MessageDecoder<Request>,
|
||||||
payload: Option<PayloadDecoder>,
|
payload: Option<PayloadDecoder>,
|
||||||
version: Version,
|
version: Version,
|
||||||
@ -104,6 +104,11 @@ impl Codec {
|
|||||||
MessageType::Payload
|
MessageType::Payload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn config(&self) -> &ServiceConfig {
|
||||||
|
&self.config
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decoder for Codec {
|
impl Decoder for Codec {
|
||||||
|
@ -567,7 +567,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
if updated && self.ka_timer.is_some() {
|
if updated && self.ka_timer.is_some() {
|
||||||
if let Some(expire) = self.codec.config.keep_alive_expire() {
|
if let Some(expire) = self.codec.config().keep_alive_expire() {
|
||||||
self.ka_expire = expire;
|
self.ka_expire = expire;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ where
|
|||||||
if self.ka_timer.is_none() {
|
if self.ka_timer.is_none() {
|
||||||
// shutdown timeout
|
// shutdown timeout
|
||||||
if self.flags.contains(Flags::SHUTDOWN) {
|
if self.flags.contains(Flags::SHUTDOWN) {
|
||||||
if let Some(interval) = self.codec.config.client_disconnect_timer() {
|
if let Some(interval) = self.codec.config().client_disconnect_timer() {
|
||||||
self.ka_timer = Some(Delay::new(interval));
|
self.ka_timer = Some(Delay::new(interval));
|
||||||
} else {
|
} else {
|
||||||
self.flags.insert(Flags::READ_DISCONNECT);
|
self.flags.insert(Flags::READ_DISCONNECT);
|
||||||
@ -607,7 +607,7 @@ where
|
|||||||
|
|
||||||
// start shutdown timer
|
// start shutdown timer
|
||||||
if let Some(deadline) =
|
if let Some(deadline) =
|
||||||
self.codec.config.client_disconnect_timer()
|
self.codec.config().client_disconnect_timer()
|
||||||
{
|
{
|
||||||
if let Some(timer) = self.ka_timer.as_mut() {
|
if let Some(timer) = self.ka_timer.as_mut() {
|
||||||
timer.reset(deadline);
|
timer.reset(deadline);
|
||||||
@ -632,7 +632,8 @@ where
|
|||||||
self.flags.insert(Flags::STARTED | Flags::SHUTDOWN);
|
self.flags.insert(Flags::STARTED | Flags::SHUTDOWN);
|
||||||
self.state = State::None;
|
self.state = State::None;
|
||||||
}
|
}
|
||||||
} else if let Some(deadline) = self.codec.config.keep_alive_expire()
|
} else if let Some(deadline) =
|
||||||
|
self.codec.config().keep_alive_expire()
|
||||||
{
|
{
|
||||||
if let Some(timer) = self.ka_timer.as_mut() {
|
if let Some(timer) = self.ka_timer.as_mut() {
|
||||||
timer.reset(deadline);
|
timer.reset(deadline);
|
||||||
|
Loading…
Reference in New Issue
Block a user