From 5e6eed905cdf76dab582271d733fca14eeb6b5af Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 12 Mar 2019 15:48:02 -0700 Subject: [PATCH] fix InFlightService::poll_ready() nested service rediness check --- actix-utils/CHANGES.md | 5 +++++ actix-utils/src/framed.rs | 4 ++-- actix-utils/src/inflight.rs | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 8850b674..c11e13ad 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -6,6 +6,11 @@ * `TimeoutService`, `InOrderService`, `InFlightService` accepts generic IntoService services. +### Fixed + +* Fix `InFlightService::poll_ready()` nested service readiness check + + ## [0.3.3] - 2019-03-09 ### Changed diff --git a/actix-utils/src/framed.rs b/actix-utils/src/framed.rs index 11d4b0e1..7389aefa 100644 --- a/actix-utils/src/framed.rs +++ b/actix-utils/src/framed.rs @@ -221,7 +221,7 @@ where fn poll_read(&mut self) -> bool { loop { match self.service.poll_ready() { - Ok(Async::Ready(_)) => loop { + Ok(Async::Ready(_)) => { let item = match self.framed.poll() { Ok(Async::Ready(Some(el))) => el, Err(err) => { @@ -244,7 +244,7 @@ where inner.task.notify(); Ok(()) })); - }, + } Ok(Async::NotReady) => return false, Err(err) => { self.state = TransportState::Error(FramedTransportError::Service(err)); diff --git a/actix-utils/src/inflight.rs b/actix-utils/src/inflight.rs index 89858f87..46030e86 100644 --- a/actix-utils/src/inflight.rs +++ b/actix-utils/src/inflight.rs @@ -67,9 +67,9 @@ where type Future = InFlightServiceResponse; fn poll_ready(&mut self) -> Poll<(), Self::Error> { - self.service.poll_ready()?; - - if !self.count.available() { + if let Async::NotReady = self.service.poll_ready()? { + Ok(Async::NotReady) + } else if !self.count.available() { log::trace!("InFlight limit exceeded"); Ok(Async::NotReady) } else {