1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

added new cancel_future_on_stop

This commit is contained in:
Nikolay Kim
2017-10-30 14:49:20 -07:00
parent e3c058c96e
commit 58de9dcf56
4 changed files with 11 additions and 6 deletions

View File

@ -35,6 +35,7 @@ pub struct HttpContext<A> where A: Actor<Context=HttpContext<A>> + Route,
impl<A> IoContext for HttpContext<A> where A: Actor<Context=Self> + Route {
fn disconnected(&mut self) {
self.items.stop();
self.disconnected = true;
if self.state == ActorState::Running {
self.state = ActorState::Stopping;
@ -46,6 +47,7 @@ impl<A> ActorContext for HttpContext<A> where A: Actor<Context=Self> + Route
{
/// Stop actor execution
fn stop(&mut self) {
self.items.stop();
self.address.close();
if self.state == ActorState::Running {
self.state = ActorState::Stopping;
@ -85,6 +87,10 @@ impl<A> AsyncContext<A> for HttpContext<A> where A: Actor<Context=Self> + Route
self.modified = true;
self.items.cancel_future(handle)
}
fn cancel_future_on_stop(&mut self, handle: SpawnHandle) {
self.items.cancel_future_on_stop(handle)
}
}
#[doc(hidden)]