Skip to content

Commit

Permalink
Added the "stop" and "kill" methods to Bastion and cleaned up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v2d0g committed Oct 20, 2019
1 parent 1e54112 commit a26238d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
12 changes: 12 additions & 0 deletions bastion/src/bastion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,16 @@ impl Bastion {
thread::yield_now();
}
}

pub fn stop() {
let msg = BastionMessage::stop();
// FIXME: Err(Error)
SYSTEM.unbounded_send(msg).ok();
}

pub fn kill() {
let msg = BastionMessage::poison_pill();
// FIXME: Err(Error)
SYSTEM.unbounded_send(msg).ok();
}
}
8 changes: 0 additions & 8 deletions bastion/src/broadcast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ impl Broadcast {
self.children.clear();
}

/*pub(super) fn start_child(&mut self, id: &BastionId) {
self.send_child(id, BastionMessage::Start);
}
pub(super) fn start_children(&mut self) {
self.send_children(BastionMessage::Start);
}*/

pub(super) fn stop_child(&mut self, id: &BastionId) {
self.send_child(id, BastionMessage::Stop);
self.unregister(id);
Expand Down
4 changes: 1 addition & 3 deletions bastion/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ impl System {
}
// FIXME
BastionMessage::SuperviseWith(_) => unimplemented!(),
BastionMessage::Message(_) => {
self.bcast.send_children(msg);
}
BastionMessage::Message(_) => self.bcast.send_children(msg),
BastionMessage::Dead { id } => {
// TODO: Err if None?
if let Some(launched) = self.launched.remove(&id) {
Expand Down

0 comments on commit a26238d

Please sign in to comment.