mirror of
https://github.com/fafhrd91/actix-net
synced 2025-01-18 20:01:48 +01:00
check readiness for all services
This commit is contained in:
parent
39356690b0
commit
6801a38de5
@ -1,6 +1,6 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use futures::{try_ready, Async, Future, Poll};
|
use futures::{Async, Future, Poll};
|
||||||
|
|
||||||
use super::{IntoNewService, NewService, Service};
|
use super::{IntoNewService, NewService, Service};
|
||||||
use crate::cell::Cell;
|
use crate::cell::Cell;
|
||||||
@ -48,8 +48,12 @@ where
|
|||||||
type Future = AndThenFuture<A, B>;
|
type Future = AndThenFuture<A, B>;
|
||||||
|
|
||||||
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
||||||
try_ready!(self.a.poll_ready());
|
let not_ready = self.a.poll_ready()?.is_not_ready();
|
||||||
self.b.get_mut().poll_ready()
|
if self.b.get_mut().poll_ready()?.is_not_ready() || not_ready {
|
||||||
|
Ok(Async::NotReady)
|
||||||
|
} else {
|
||||||
|
Ok(Async::Ready(()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, req: A::Request) -> Self::Future {
|
fn call(&mut self, req: A::Request) -> Self::Future {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use futures::{try_ready, Async, Future, IntoFuture, Poll};
|
use futures::{Async, Future, IntoFuture, Poll};
|
||||||
|
|
||||||
use super::{IntoNewService, IntoService, NewService, Service};
|
use super::{IntoNewService, IntoService, NewService, Service};
|
||||||
use crate::cell::Cell;
|
use crate::cell::Cell;
|
||||||
@ -71,8 +71,12 @@ where
|
|||||||
type Future = AndThenApplyFuture<A, B, F, Out>;
|
type Future = AndThenApplyFuture<A, B, F, Out>;
|
||||||
|
|
||||||
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
||||||
try_ready!(self.a.poll_ready());
|
let not_ready = self.a.poll_ready()?.is_not_ready();
|
||||||
self.b.get_mut().poll_ready()
|
if self.b.get_mut().poll_ready()?.is_not_ready() || not_ready {
|
||||||
|
Ok(Async::NotReady)
|
||||||
|
} else {
|
||||||
|
Ok(Async::Ready(()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, req: A::Request) -> Self::Future {
|
fn call(&mut self, req: A::Request) -> Self::Future {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use futures::{try_ready, Async, Future, Poll};
|
use futures::{Async, Future, Poll};
|
||||||
|
|
||||||
use super::{IntoNewService, NewService, Service};
|
use super::{IntoNewService, NewService, Service};
|
||||||
use crate::cell::Cell;
|
use crate::cell::Cell;
|
||||||
@ -48,8 +48,12 @@ where
|
|||||||
type Future = ThenFuture<A, B>;
|
type Future = ThenFuture<A, B>;
|
||||||
|
|
||||||
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
fn poll_ready(&mut self) -> Poll<(), Self::Error> {
|
||||||
try_ready!(self.a.poll_ready());
|
let not_ready = self.a.poll_ready()?.is_not_ready();
|
||||||
self.b.get_mut().poll_ready()
|
if self.b.get_mut().poll_ready()?.is_not_ready() || not_ready {
|
||||||
|
Ok(Async::NotReady)
|
||||||
|
} else {
|
||||||
|
Ok(Async::Ready(()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&mut self, req: A::Request) -> Self::Future {
|
fn call(&mut self, req: A::Request) -> Self::Future {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user