mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-23 22:51:07 +01:00
Release future early for .and_then() and .then() combinators
This commit is contained in:
parent
e8a1664c15
commit
61939c7af2
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
## [0.1.2] - 2018-12-12
|
||||
|
||||
### Fixed
|
||||
|
||||
* Release future early for `.and_then()` and `.then()` combinators
|
||||
|
||||
|
||||
## [0.1.1] - 2018-12-09
|
||||
|
||||
### Added
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-service"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix Service"
|
||||
keywords = ["network", "framework", "async", "futures"]
|
||||
|
@ -61,7 +61,7 @@ where
|
||||
{
|
||||
b: Cell<B>,
|
||||
fut_b: Option<B::Future>,
|
||||
fut_a: A::Future,
|
||||
fut_a: Option<A::Future>,
|
||||
}
|
||||
|
||||
impl<A, B, Request> AndThenFuture<A, B, Request>
|
||||
@ -69,10 +69,10 @@ where
|
||||
A: Service<Request>,
|
||||
B: Service<A::Response, Error = A::Error>,
|
||||
{
|
||||
fn new(fut_a: A::Future, b: Cell<B>) -> Self {
|
||||
fn new(a: A::Future, b: Cell<B>) -> Self {
|
||||
AndThenFuture {
|
||||
b,
|
||||
fut_a,
|
||||
fut_a: Some(a),
|
||||
fut_b: None,
|
||||
}
|
||||
}
|
||||
@ -91,8 +91,9 @@ where
|
||||
return fut.poll();
|
||||
}
|
||||
|
||||
match self.fut_a.poll() {
|
||||
match self.fut_a.as_mut().expect("Bug in actix-service").poll() {
|
||||
Ok(Async::Ready(resp)) => {
|
||||
let _ = self.fut_a.take();
|
||||
self.fut_b = Some(self.b.get_mut().call(resp));
|
||||
self.poll()
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ where
|
||||
{
|
||||
b: Cell<B>,
|
||||
fut_b: Option<B::Future>,
|
||||
fut_a: A::Future,
|
||||
fut_a: Option<A::Future>,
|
||||
}
|
||||
|
||||
impl<A, B, Request> ThenFuture<A, B, Request>
|
||||
@ -69,10 +69,10 @@ where
|
||||
A: Service<Request>,
|
||||
B: Service<Result<A::Response, A::Error>>,
|
||||
{
|
||||
fn new(fut_a: A::Future, b: Cell<B>) -> Self {
|
||||
fn new(a: A::Future, b: Cell<B>) -> Self {
|
||||
ThenFuture {
|
||||
b,
|
||||
fut_a,
|
||||
fut_a: Some(a),
|
||||
fut_b: None,
|
||||
}
|
||||
}
|
||||
@ -91,12 +91,14 @@ where
|
||||
return fut.poll();
|
||||
}
|
||||
|
||||
match self.fut_a.poll() {
|
||||
match self.fut_a.as_mut().expect("bug in actix-service").poll() {
|
||||
Ok(Async::Ready(resp)) => {
|
||||
let _ = self.fut_a.take();
|
||||
self.fut_b = Some(self.b.get_mut().call(Ok(resp)));
|
||||
self.poll()
|
||||
}
|
||||
Err(err) => {
|
||||
let _ = self.fut_a.take();
|
||||
self.fut_b = Some(self.b.get_mut().call(Err(err)));
|
||||
self.poll()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user