From 5baf15822a3f885c76d1856ba78bfe8a209ab31b Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 16 Mar 2018 07:46:27 -0700 Subject: [PATCH] always start actors --- src/context.rs | 2 +- src/pipeline.rs | 1 + src/ws/context.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/context.rs b/src/context.rs index aa6f4c49a..1a2680021 100644 --- a/src/context.rs +++ b/src/context.rs @@ -188,7 +188,7 @@ impl ActorHttpContext for HttpContext where A: Actor, mem::transmute(self as &mut HttpContext) }; - if self.inner.alive() { + if self.inner.started() && self.inner.alive() { match self.inner.poll(ctx) { Ok(Async::NotReady) | Ok(Async::Ready(())) => (), Err(_) => return Err(ErrorInternalServerError("error").into()), diff --git a/src/pipeline.rs b/src/pipeline.rs index b895be8c6..0f9b3533a 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -481,6 +481,7 @@ impl ProcessResponse { } } + // always poll stream or actor for the first time match self.resp.replace_body(Body::Empty) { Body::Streaming(stream) => { self.iostate = IOState::Payload(stream); diff --git a/src/ws/context.rs b/src/ws/context.rs index 4b0775f6a..26aa5cb10 100644 --- a/src/ws/context.rs +++ b/src/ws/context.rs @@ -204,7 +204,7 @@ impl ActorHttpContext for WebsocketContext where A: Actor) }; - if self.inner.alive() && self.inner.poll(ctx).is_err() { + if self.inner.started() && self.inner.alive() && self.inner.poll(ctx).is_err() { return Err(ErrorInternalServerError("error").into()) }