1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 16:52:58 +01:00

revert 1.0.3 changes

This commit is contained in:
Nikolay Kim 2020-01-15 13:24:38 -08:00
parent 5940731ef0
commit 3116db5168
5 changed files with 20 additions and 21 deletions

View File

@ -1,5 +1,11 @@
# Changes
## [1.0.4] - 2020-01-15
### Fixed
* Revert 1.0.3 change
## [1.0.3] - 2020-01-15
### Fixed

View File

@ -1,6 +1,6 @@
[package]
name = "actix-service"
version = "1.0.3"
version = "1.0.4"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix service"
keywords = ["network", "framework", "async", "futures"]
@ -13,7 +13,6 @@ edition = "2018"
[badges]
travis-ci = { repository = "actix/actix-service", branch = "master" }
appveyor = { repository = "actix/actix-net" }
codecov = { repository = "actix/actix-service", branch = "master", service = "github" }
[lib]

View File

@ -9,7 +9,7 @@ use crate::cell::Cell;
/// of another service which completes successfully.
///
/// This is created by the `ServiceExt::and_then` method.
pub struct AndThenService<A, B>(Cell<(A, B)>);
pub struct AndThenService<A, B>(Cell<A>, Cell<B>);
impl<A, B> AndThenService<A, B> {
/// Create new `AndThen` combinator
@ -18,13 +18,13 @@ impl<A, B> AndThenService<A, B> {
A: Service,
B: Service<Request = A::Response, Error = A::Error>,
{
Self(Cell::new((a, b)))
Self(Cell::new(a), Cell::new(b))
}
}
impl<A, B> Clone for AndThenService<A, B> {
fn clone(&self) -> Self {
AndThenService(self.0.clone())
AndThenService(self.0.clone(), self.1.clone())
}
}
@ -39,10 +39,8 @@ where
type Future = AndThenServiceResponse<A, B>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
let srv = self.0.get_mut();
let not_ready = !srv.0.poll_ready(cx)?.is_ready();
if !srv.1.poll_ready(cx)?.is_ready() || not_ready {
let not_ready = { !self.0.get_mut().poll_ready(cx)?.is_ready() };
if !self.1.poll_ready(cx)?.is_ready() || not_ready {
Poll::Pending
} else {
Poll::Ready(Ok(()))
@ -51,7 +49,7 @@ where
fn call(&mut self, req: A::Request) -> Self::Future {
AndThenServiceResponse {
state: State::A(self.0.get_mut().0.call(req), Some(self.0.clone())),
state: State::A(self.0.get_mut().call(req), Some(self.1.clone())),
}
}
}
@ -72,7 +70,7 @@ where
A: Service,
B: Service<Request = A::Response, Error = A::Error>,
{
A(#[pin] A::Future, Option<Cell<(A, B)>>),
A(#[pin] A::Future, Option<Cell<B>>),
B(#[pin] B::Future),
Empty,
}
@ -94,7 +92,7 @@ where
Poll::Ready(res) => {
let mut b = b.take().unwrap();
this.state.set(State::Empty); // drop fut A
let fut = b.get_mut().1.call(res);
let fut = b.get_mut().call(res);
this.state.set(State::B(fut));
self.poll(cx)
}

View File

@ -50,7 +50,7 @@ impl<T: Service> Pipeline<T> {
where
Self: Sized,
F: IntoService<U>,
U: Service<Request = T::Response, Error = T::Error> + 'static,
U: Service<Request = T::Response, Error = T::Error>,
{
Pipeline {
service: AndThenService::new(self.service, service.into_service()),
@ -69,7 +69,7 @@ impl<T: Service> Pipeline<T> {
where
Self: Sized,
I: IntoService<U>,
U: Service + 'static,
U: Service,
F: FnMut(T::Response, &mut U) -> Fut,
Fut: Future<Output = Result<Res, Err>>,
Err: From<T::Error> + From<U::Error>,
@ -88,7 +88,7 @@ impl<T: Service> Pipeline<T> {
where
Self: Sized,
F: IntoService<U>,
U: Service<Request = Result<T::Response, T::Error>, Error = T::Error> + 'static,
U: Service<Request = Result<T::Response, T::Error>, Error = T::Error>,
{
Pipeline {
service: ThenService::new(self.service, service.into_service()),
@ -179,7 +179,6 @@ impl<T: ServiceFactory> PipelineFactory<T> {
Error = T::Error,
InitError = T::InitError,
>,
U::Service: 'static,
{
PipelineFactory {
factory: AndThenServiceFactory::new(self.factory, factory.into_factory()),
@ -200,7 +199,6 @@ impl<T: ServiceFactory> PipelineFactory<T> {
T::Config: Clone,
I: IntoServiceFactory<U>,
U: ServiceFactory<Config = T::Config, InitError = T::InitError>,
U::Service: 'static,
F: FnMut(T::Response, &mut U::Service) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
Err: From<T::Error> + From<U::Error>,
@ -227,7 +225,6 @@ impl<T: ServiceFactory> PipelineFactory<T> {
Error = T::Error,
InitError = T::InitError,
>,
U::Service: 'static,
{
PipelineFactory {
factory: ThenServiceFactory::new(self.factory, factory.into_factory()),

View File

@ -10,15 +10,14 @@ documentation = "https://docs.rs/actix-tracing/"
categories = ["network-programming", "asynchronous"]
license = "MIT/Apache-2.0"
edition = "2018"
workspace = ".."
[lib]
name = "actix_tracing"
path = "src/lib.rs"
[dependencies]
actix-service = "1.0"
futures-util = "0.3"
actix-service = "1.0.3"
futures-util = "0.3.1"
tracing = "0.1"
tracing-futures = "0.2"