X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fdatastore.rs;h=1dd976aa4e8863a33d60fca0b6eed9a4f01002bb;hb=46abcf4ec312fddf75e60ce0fde055794b4b817a;hp=7b12adb76b845e24db57cddb209e3d299a70859f;hpb=4f98fdc91bc97ca1680daab6fb208d93470ee51a;p=dnsseed-rust diff --git a/src/datastore.rs b/src/datastore.rs index 7b12adb..1dd976a 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -270,10 +270,11 @@ impl Store { } } - pub fn set_node_state(&self, addr: SocketAddr, state: AddressState, services: u64) { + pub fn set_node_state(&self, addr: SocketAddr, state: AddressState, services: u64) -> bool { let mut nodes_lock = self.nodes.write().unwrap(); let nodes = nodes_lock.borrow_mut(); let state_ref = nodes.nodes_to_state.get_mut(&addr).unwrap(); + let ret = state != state_ref.state; state_ref.last_update = Instant::now(); if (state_ref.state == AddressState::Good || state_ref.state == AddressState::WasGood) && state != AddressState::Good @@ -301,6 +302,7 @@ impl Store { } nodes.state_next_scan.get_mut(&state).unwrap().push((state_ref.last_update, addr)); } + ret } pub fn save_data(&'static self) -> impl Future {