diff --git a/src/context.rs b/src/context.rs index 76be616cf..cdeb43d16 100644 --- a/src/context.rs +++ b/src/context.rs @@ -75,7 +75,8 @@ impl AsyncContext for HttpContext where A: Actor #[doc(hidden)] #[inline] fn waiting(&self) -> bool { - self.inner.wating() + self.inner.waiting() || self.inner.state() == ActorState::Stopping || + self.inner.state() == ActorState::Stopped } #[inline] fn cancel_future(&mut self, handle: SpawnHandle) -> bool { diff --git a/src/payload.rs b/src/payload.rs index 002034da7..a7b008132 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -420,7 +420,7 @@ impl Inner { } pub fn readall(&mut self) -> Option { - let len = self.items.iter().fold(0, |cur, item| cur + item.len()); + let len = self.items.iter().map(|b| b.len()).sum(); if len > 0 { let mut buf = BytesMut::with_capacity(len); for item in &self.items { diff --git a/src/ws/context.rs b/src/ws/context.rs index 749886744..2ad164b47 100644 --- a/src/ws/context.rs +++ b/src/ws/context.rs @@ -58,7 +58,7 @@ impl AsyncContext for WebsocketContext where A: Actor bool { - self.inner.wating() || self.inner.state() == ActorState::Stopping || + self.inner.waiting() || self.inner.state() == ActorState::Stopping || self.inner.state() == ActorState::Stopped }