checkpoint

This commit is contained in:
John Smith
2022-11-21 22:50:42 -05:00
parent 4e1c3391df
commit 27f7f49d4f
11 changed files with 64 additions and 20 deletions

View File

@@ -85,8 +85,11 @@ pub struct BucketEntryInner {
/// The minimum and maximum range of cryptography versions supported by the node,
/// inclusive of the requirements of any relay the node may be using
min_max_version: Option<VersionRange>,
/// Whether or not we have updated this peer with our node info since our network
/// If this node has updated it's SignedNodeInfo since our network
/// and dial info has last changed, for example when our IP address changes
/// Used to determine if we should make this entry 'live' again when we receive a signednodeinfo update that
/// has the same timestamp, because if we change our own IP address or network class it may be possible for nodes that were
/// unreachable may now be reachable with the same SignedNodeInfo/DialInfo
updated_since_last_network_change: bool,
/// The last connection descriptors used to contact this node, per protocol type
#[with(Skip)]

View File

@@ -1268,35 +1268,32 @@ impl RouteSpecStore {
.unwrap_or_default()
}
/// Mark a remote private route as having seen our node info {
pub fn mark_remote_private_route_seen_our_node_info(&self, key: &DHTKey) {
/// Mark a remote private route as having seen our node info
pub fn mark_remote_private_route_seen_our_node_info(&self, key: &DHTKey, cur_ts: u64) {
let inner = &mut *self.inner.lock();
let cur_ts = intf::get_timestamp();
Self::with_create_remote_private_route(inner, cur_ts, key, |rpr| {
rpr.seen_our_node_info = true;
})
}
/// Mark a remote private route as having replied to a question {
pub fn mark_remote_private_route_replied(&self, key: &DHTKey) {
pub fn mark_remote_private_route_replied(&self, key: &DHTKey, cur_ts: u64) {
let inner = &mut *self.inner.lock();
let cur_ts = intf::get_timestamp();
Self::with_create_remote_private_route(inner, cur_ts, key, |rpr| {
rpr.last_replied_ts = Some(cur_ts);
})
}
/// Mark a remote private route as having beed used {
pub fn mark_remote_private_route_used(&self, key: &DHTKey) {
pub fn mark_remote_private_route_used(&self, key: &DHTKey, cur_ts: u64) {
let inner = &mut *self.inner.lock();
let cur_ts = intf::get_timestamp();
Self::with_create_remote_private_route(inner, cur_ts, key, |rpr| {
rpr.last_used_ts = Some(cur_ts);
})
}
/// Clear caches when local our local node info changes
pub fn local_node_info_changed(&self) {
pub fn reset(&self) {
let inner = &mut *self.inner.lock();
// Clean up local allocated routes

View File

@@ -194,14 +194,25 @@ impl RoutingDomainEditor {
}
}
if changed {
// Clear our 'peer info' cache, the peerinfo for this routing domain will get regenerated next time it is asked for
detail.common_mut().clear_cache()
}
});
if changed {
// Mark that nothing in the routing table has seen our new node info
inner.reset_all_seen_our_node_info(self.routing_domain);
//
inner.reset_all_updated_since_last_network_change();
}
}
// Clear the routespecstore cache if our PublicInternet dial info has changed
if changed {
if self.routing_domain == RoutingDomain::PublicInternet {
let rss = self.routing_table.route_spec_store();
rss.reset();
}
}
// Send our updated node info to all the nodes in the routing table
if changed && self.send_node_info_updates {
let network_manager = self.routing_table.unlocked_inner.network_manager.clone();
network_manager