diff --git a/src/context.rs b/src/context.rs index aa6f4c49..1a268002 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 b895be8c..0f9b3533 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 4b0775f6..26aa5cb1 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()) }