1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-21 17:33:59 +00: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<()>),
}
impl Frame {
pub fn len(&self) -> usize {
match *self {
Frame::Chunk(Some(ref bin)) => bin.len(),
_ => 0,
}
}
}
/// Http actor execution context
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)]
#[inline]
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 {