Skip to content

Commit

Permalink
simplify stop_all
Browse files Browse the repository at this point in the history
  • Loading branch information
rjwalters committed Jun 18, 2020
1 parent 98baf20 commit 9b0a33d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions consensus/scp/tests/mock_network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,12 @@ impl SimulatedNetwork {
.lock()
.expect("lock failed on nodes_map in stop_all");

let num_nodes = nodes_map.len();
for node_num in 0..num_nodes {
nodes_map
.get_mut(&test_utils::test_node_id(node_num as u32))
.expect("could not find node_id in nodes_map")
.send_stop();
for (_node_id, node) in nodes_map.iter_mut() {
node.send_stop();
}
drop(nodes_map);

// now join the threads
for node_num in 0..num_nodes {
let node_id = &test_utils::test_node_id(node_num as u32);
for node_id in nodes_map.keys() {
self.handle_map
.remove(node_id)
.expect("thread handle is missing")
Expand Down

0 comments on commit 9b0a33d

Please sign in to comment.