use Router::recognize_checked

This commit is contained in:
fakeshadow 2021-01-15 20:26:40 +08:00
parent 4c6c899b6e
commit bbf90697b0
3 changed files with 4 additions and 7 deletions

View File

@ -21,7 +21,7 @@ impl<T> WsService<T> {
WsService(Arc::new(Mutex::new((PhantomData, Cell::new(false))))) WsService(Arc::new(Mutex::new((PhantomData, Cell::new(false)))))
} }
fn set_polled(&mut self) { fn set_polled(&self) {
*self.0.lock().unwrap().1.get_mut() = true; *self.0.lock().unwrap().1.get_mut() = true;
} }
@ -49,10 +49,7 @@ where
Poll::Ready(Ok(())) Poll::Ready(Ok(()))
} }
fn call( fn call(&self, (req, mut framed): (Request, Framed<T, h1::Codec>)) -> Self::Future {
&mut self,
(req, mut framed): (Request, Framed<T, h1::Codec>),
) -> Self::Future {
let fut = async move { let fut = async move {
let res = ws::handshake(req.head()).unwrap().message_body(()); let res = ws::handshake(req.head()).unwrap().message_body(());

View File

@ -295,7 +295,7 @@ impl Service<ServiceRequest> for AppRouting {
actix_service::always_ready!(); actix_service::always_ready!();
fn call(&self, mut req: ServiceRequest) -> Self::Future { fn call(&self, mut req: ServiceRequest) -> Self::Future {
let res = self.router.recognize_mut_checked(&mut req, |req, guards| { let res = self.router.recognize_checked(&mut req, |req, guards| {
if let Some(ref guards) = guards { if let Some(ref guards) = guards {
for f in guards { for f in guards {
if !f.check(req.head()) { if !f.check(req.head()) {

View File

@ -541,7 +541,7 @@ impl Service<ServiceRequest> for ScopeService {
actix_service::always_ready!(); actix_service::always_ready!();
fn call(&self, mut req: ServiceRequest) -> Self::Future { fn call(&self, mut req: ServiceRequest) -> Self::Future {
let res = self.router.recognize_mut_checked(&mut req, |req, guards| { let res = self.router.recognize_checked(&mut req, |req, guards| {
if let Some(ref guards) = guards { if let Some(ref guards) = guards {
for f in guards { for f in guards {
if !f.check(req.head()) { if !f.check(req.head()) {