drop unneeded enum item
@@ -22,8 +22,6 @@ pub enum ActorState {
Running,
/// Actor is stopping.
Stopping,
- /// Actor is prepared for stop.
- PrepStop,
/// Actor is stopped.
Stopped,
}
@@ -241,6 +239,8 @@ impl<A> Future for Context<A> where A: Actor
_ => ()
}
+ let mut prep_stop = false;
+
loop {
let mut not_ready = true;
@@ -307,13 +307,9 @@ impl<A> Future for Context<A> where A: Actor
self.state = ActorState::Stopped;
Actor::stopped(&mut self.act, ctx);
return Ok(Async::Ready(()))
- }
+ },
ActorState::Stopping => {
- Actor::stopping(&mut self.act, ctx);
- self.state = ActorState::PrepStop;
- continue
- }
- ActorState::PrepStop => {
+ if prep_stop {
if self.address.connected() || !self.items.is_empty() {
self.state = ActorState::Running;
continue
@@ -322,15 +318,20 @@ impl<A> Future for Context<A> where A: Actor
Actor::stopped(&mut self.act, ctx);
return Ok(Async::Ready(()))
}
+ } else {
+ Actor::stopping(&mut self.act, ctx);
+ prep_stop = true;
+ continue
}
+ },
ActorState::Running => {
if !self.address.connected() && self.items.is_empty() {
self.state = ActorState::Stopping;
Actor::stopping(&mut self.act, ctx);
- self.state = ActorState::PrepStop;
+ prep_stop = true;
continue
}
- }
+ },
_ => (),
}
