1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-12-01 02:44:37 +01:00

stop websocket context

This commit is contained in:
Nikolay Kim 2018-01-23 15:35:39 -08:00
parent 35efd017bb
commit f4873fcdee
2 changed files with 11 additions and 1 deletions

View File

@ -27,6 +27,15 @@ pub enum Frame {
Drain(oneshot::Sender<()>), Drain(oneshot::Sender<()>),
} }
impl Frame {
pub fn len(&self) -> usize {
match *self {
Frame::Chunk(Some(ref bin)) => bin.len(),
_ => 0,
}
}
}
/// Http actor execution context /// Http actor execution context
pub struct HttpContext<A, S=()> where A: Actor<Context=HttpContext<A, S>>, pub struct HttpContext<A, S=()> where A: Actor<Context=HttpContext<A, S>>,
{ {

View File

@ -58,7 +58,8 @@ impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where A: Actor<Context=Sel
#[doc(hidden)] #[doc(hidden)]
#[inline] #[inline]
fn waiting(&self) -> bool { fn waiting(&self) -> bool {
self.inner.wating() self.inner.wating() || self.inner.start() == ActorState::Stopping ||
self.inner.start() == ActorState::Stopped
} }
fn cancel_future(&mut self, handle: SpawnHandle) -> bool { fn cancel_future(&mut self, handle: SpawnHandle) -> bool {