mirror of https://github.com/fafhrd91/actix-web
use recursive poll
This commit is contained in:
parent
2394890bf1
commit
e7ec216842
|
@ -152,26 +152,22 @@ where
|
||||||
type Output = Fut::Output;
|
type Output = Fut::Output;
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||||
loop {
|
match self.as_mut().project() {
|
||||||
match self.as_mut().project() {
|
ErrorHandlersProj::ServiceFuture { fut, handlers } => {
|
||||||
ErrorHandlersProj::ServiceFuture { fut, handlers } => {
|
let res = ready!(fut.poll(cx))?;
|
||||||
let res = ready!(fut.poll(cx))?;
|
match handlers.get(&res.status()) {
|
||||||
match handlers.get(&res.status()) {
|
Some(handler) => match handler(res)? {
|
||||||
Some(handler) => match handler(res)? {
|
ErrorHandlerResponse::Response(res) => Poll::Ready(Ok(res)),
|
||||||
ErrorHandlerResponse::Response(res) => {
|
ErrorHandlerResponse::Future(fut) => {
|
||||||
return Poll::Ready(Ok(res))
|
self.as_mut()
|
||||||
}
|
.set(ErrorHandlersFuture::HandlerFuture { fut });
|
||||||
ErrorHandlerResponse::Future(fut) => self
|
self.poll(cx)
|
||||||
.as_mut()
|
}
|
||||||
.set(ErrorHandlersFuture::HandlerFuture { fut }),
|
},
|
||||||
},
|
None => Poll::Ready(Ok(res)),
|
||||||
None => return Poll::Ready(Ok(res)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ErrorHandlersProj::HandlerFuture { fut } => {
|
|
||||||
return fut.as_mut().poll(cx)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ErrorHandlersProj::HandlerFuture { fut } => fut.as_mut().poll(cx),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue