From b16f2d5f05f891a7da788974ff1216b42baa331d Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 16 Mar 2018 08:04:26 -0700 Subject: [PATCH] proper check for actor context poll --- src/context.rs | 2 +- src/ws/context.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context.rs b/src/context.rs index 1a2680021..2e703ac15 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.started() && self.inner.alive() { + if !self.inner.started() || 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/ws/context.rs b/src/ws/context.rs index 26aa5cb10..7040345fb 100644 --- a/src/ws/context.rs +++ b/src/ws/context.rs @@ -204,8 +204,9 @@ impl ActorHttpContext for WebsocketContext where A: Actor) }; - if self.inner.started() && self.inner.alive() && self.inner.poll(ctx).is_err() { - return Err(ErrorInternalServerError("error").into()) + if (!self.inner.started() || self.inner.started() && self.inner.alive()) + && self.inner.poll(ctx).is_err() { + return Err(ErrorInternalServerError("error").into()) } // frames