diff --git a/actix-tower/src/lib.rs b/actix-tower/src/lib.rs index 891b5017..4c172a72 100644 --- a/actix-tower/src/lib.rs +++ b/actix-tower/src/lib.rs @@ -81,7 +81,7 @@ impl ActixCompat { /// Extension trait for wrapping a `tower_service::Service` instance for use as /// an `actix_service::Service`. -pub trait TowerServiceExt : TowerService + Sized { +pub trait TowerServiceExt: TowerService + Sized { /// Wraps a `tower_service::Service` in a compatibility wrapper. /// /// ``` @@ -167,16 +167,13 @@ pub trait TowerServiceExt : TowerService + Sized { fn wrap_with_actix_middleware(self, f: F) -> TowerCompat where F: FnOnce(ActixCompat) -> U, - U: ActixService + U: ActixService, { f(self.into_actix_service()).into_tower_service() } } -impl TowerServiceExt for S -where - S: TowerService + Sized -{} +impl TowerServiceExt for S where S: TowerService + Sized {} impl ActixService for ActixCompat where @@ -207,9 +204,7 @@ pub struct TowerCompat { impl TowerCompat { /// Wraps an `actix_service::Service` in a compatibility wrapper. pub fn new(inner: S) -> Self { - TowerCompat { - inner, - } + TowerCompat { inner } } } @@ -302,16 +297,13 @@ pub trait ActixServiceExt: ActixService + Sized { fn wrap_with_tower_middleware(self, f: F) -> ActixCompat where F: FnOnce(TowerCompat) -> U, - U: TowerService + U: TowerService, { f(self.into_tower_service()).into_actix_service() } } -impl ActixServiceExt for S -where - S: ActixService + Sized -{} +impl ActixServiceExt for S where S: ActixService + Sized {} impl TowerService for TowerCompat where @@ -335,10 +327,9 @@ mod tests { mod tower_service_into_actix_service { use crate::TowerServiceExt; use actix_service::{Service as ActixService, ServiceExt, Transform}; - use futures::{future::FutureResult, Async, Poll, Future}; + use futures::{future::FutureResult, Async, Future, Poll}; use tower_service::Service as TowerService; - #[test] fn random_service_returns_4() { let mut s = RandomService.into_actix_service(); @@ -397,7 +388,10 @@ mod tests { fn random_service_can_be_transformed_to_do_math() { let transform = DoMath; - let mut s = transform.new_transform(RandomService.into_actix_service()).wait().unwrap(); + let mut s = transform + .new_transform(RandomService.into_actix_service()) + .wait() + .unwrap(); assert_eq!(Ok(Async::Ready(())), s.poll_ready()); @@ -477,10 +471,9 @@ mod tests { mod actix_service_into_tower_service { use crate::{ActixServiceExt, TowerServiceExt}; use actix_service::{Service as ActixService, ServiceExt}; - use futures::{future::FutureResult, Async, Poll, Future}; + use futures::{future::FutureResult, Async, Future, Poll}; use tower_service::Service as TowerService; - #[test] fn random_service_returns_4() { let mut s = RandomService.into_tower_service(); @@ -492,7 +485,8 @@ mod tests { #[test] fn random_service_can_use_tower_middleware() { - let mut s = AddOneService::wrap(RandomService.into_tower_service()).into_actix_service(); + let mut s = + AddOneService::wrap(RandomService.into_tower_service()).into_actix_service(); assert_eq!(Ok(Async::Ready(())), s.poll_ready()); @@ -501,7 +495,8 @@ mod tests { #[test] fn do_math_service_can_use_tower_middleware() { - let mut s = AddOneService::wrap(DoMathService.into_tower_service()).into_actix_service(); + let mut s = + AddOneService::wrap(DoMathService.into_tower_service()).into_actix_service(); assert_eq!(Ok(Async::Ready(())), s.poll_ready()); @@ -537,14 +532,12 @@ mod tests { } struct AddOneService { - inner: S + inner: S, } impl AddOneService { fn wrap(inner: S) -> Self { - AddOneService { - inner, - } + AddOneService { inner } } } @@ -562,8 +555,7 @@ mod tests { } fn call(&mut self, req: R) -> Self::Future { - let fut = self.inner.call(req) - .map(|x| x + 1); + let fut = self.inner.call(req).map(|x| x + 1); Box::new(fut) } @@ -583,5 +575,6 @@ mod tests { fn call(&mut self, req: Self::Request) -> Self::Future { futures::finished(req * 17) } - }} -} \ No newline at end of file + } + } +} diff --git a/actix-utils/CHANGES.md b/actix-utils/CHANGES.md index 1e4f1b5e..a4f3e0a9 100644 --- a/actix-utils/CHANGES.md +++ b/actix-utils/CHANGES.md @@ -1,6 +1,13 @@ # Changes -##[0.4.1] - 2019-05-15 +## [0.4.2] - 2019-06-26 + +### Fixed + +* Do not block on sink drop for FramedTransport + + +## [0.4.1] - 2019-05-15 ### Changed diff --git a/actix-utils/Cargo.toml b/actix-utils/Cargo.toml index b71930b5..bfd03281 100644 --- a/actix-utils/Cargo.toml +++ b/actix-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-utils" -version = "0.4.1" +version = "0.4.2" authors = ["Nikolay Kim "] description = "Actix utils - various actix net related services" keywords = ["network", "framework", "async", "futures"] @@ -18,8 +18,8 @@ name = "actix_utils" path = "src/lib.rs" [dependencies] -actix-service = "0.4.0" -actix-codec = "0.1.1" +actix-service = "0.4.1" +actix-codec = "0.1.2" bytes = "0.4" either = "1.5.2" futures = "0.1.25" diff --git a/actix-utils/src/framed.rs b/actix-utils/src/framed.rs index 4633d51c..7be2c750 100644 --- a/actix-utils/src/framed.rs +++ b/actix-utils/src/framed.rs @@ -187,10 +187,12 @@ where return true; } Ok(Async::Ready(None)) => { + rx_done = true; let _ = self.rx.take(); } Ok(Async::NotReady) => rx_done = true, Err(_e) => { + rx_done = true; let _ = self.rx.take(); } }