1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 17:46:38 +02:00

fix ssh handshake timeout

This commit is contained in:
Nikolay Kim
2018-10-02 11:18:59 -07:00
parent 61c7534e03
commit 724668910b
4 changed files with 90 additions and 37 deletions

View File

@@ -176,12 +176,15 @@ where
/// Applies timeout to request prcoessing.
pub(crate) struct AcceptorTimeout<T> {
inner: T,
timeout: u64,
timeout: Duration,
}
impl<T: NewService> AcceptorTimeout<T> {
pub(crate) fn new(timeout: u64, inner: T) -> Self {
Self { inner, timeout }
Self {
inner,
timeout: Duration::from_millis(timeout),
}
}
}
@@ -204,7 +207,7 @@ impl<T: NewService> NewService for AcceptorTimeout<T> {
#[doc(hidden)]
pub(crate) struct AcceptorTimeoutFut<T: NewService> {
fut: T::Future,
timeout: u64,
timeout: Duration,
}
impl<T: NewService> Future for AcceptorTimeoutFut<T> {
@@ -225,7 +228,7 @@ impl<T: NewService> Future for AcceptorTimeoutFut<T> {
/// Applies timeout to request prcoessing.
pub(crate) struct AcceptorTimeoutService<T> {
inner: T,
timeout: u64,
timeout: Duration,
}
impl<T: Service> Service for AcceptorTimeoutService<T> {
@@ -241,7 +244,7 @@ impl<T: Service> Service for AcceptorTimeoutService<T> {
fn call(&mut self, req: Self::Request) -> Self::Future {
AcceptorTimeoutResponse {
fut: self.inner.call(req),
sleep: sleep(Duration::from_millis(self.timeout)),
sleep: sleep(self.timeout),
}
}
}