1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

simplify pipeline

This commit is contained in:
Nikolay Kim
2018-05-07 16:09:41 -07:00
parent 3c6c1268c9
commit 8cda362866
3 changed files with 33 additions and 50 deletions

View File

@@ -346,21 +346,12 @@ impl<S: 'static> StartMiddlewares<S> {
Ok(MiddlewareStarted::Response(resp)) => {
return RunMiddlewares::init(info, resp)
}
Ok(MiddlewareStarted::Future(mut fut)) => match fut.poll() {
Ok(Async::NotReady) => {
return ComposeState::Starting(StartMiddlewares {
fut: Some(fut),
_s: PhantomData,
})
}
Ok(Async::Ready(resp)) => {
if let Some(resp) = resp {
return RunMiddlewares::init(info, resp);
}
info.count += 1;
}
Err(err) => return FinishingMiddlewares::init(info, err.into()),
},
Ok(MiddlewareStarted::Future(fut)) => {
return ComposeState::Starting(StartMiddlewares {
fut: Some(fut),
_s: PhantomData,
})
}
Err(err) => return FinishingMiddlewares::init(info, err.into()),
}
}