X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=dnsseed-rust;a=blobdiff_plain;f=src%2Fdatastore.rs;fp=src%2Fdatastore.rs;h=6f4345883faca87005ab68984cb5a674827677e2;hp=0b608f9f536397d60740f8fc8cbf0fc112b74299;hb=9a2de993b847d3fc26571437e22ea43a014ac809;hpb=b33d356950ee5c6776ffe6e8655e66d080941d1d diff --git a/src/datastore.rs b/src/datastore.rs index 0b608f9..6f43458 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -174,12 +174,12 @@ impl SockAddr { struct Nodes { good_node_services: [HashSet; 64], nodes_to_state: HashMap, - state_next_scan: Vec>, + state_next_scan: [Vec; AddressState::get_count() as usize], } struct NodesMutRef<'a> { good_node_services: &'a mut [HashSet; 64], nodes_to_state: &'a mut HashMap, - state_next_scan: &'a mut Vec>, + state_next_scan: &'a mut [Vec; AddressState::get_count() as usize], } impl Nodes { @@ -262,10 +262,7 @@ impl Store { macro_rules! nodes_uninitd { () => { { - let mut state_vecs = Vec::with_capacity(AddressState::get_count() as usize); - for _ in 0..AddressState::get_count() { - state_vecs.push(Vec::new()); - } + let state_vecs = [Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new(), Vec::new()]; let good_node_services = [HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new()]; Nodes { good_node_services,