dont blow away routes every 5 seconds

This commit is contained in:
Christien Rioux 2023-10-19 22:26:39 -04:00
parent d87ece1c81
commit 2a1b3762c8
4 changed files with 545 additions and 288 deletions

23
Cargo.lock generated
View File

@ -1241,6 +1241,16 @@ dependencies = [
"subtle",
]
[[package]]
name = "ctor"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583"
dependencies = [
"quote",
"syn 2.0.38",
]
[[package]]
name = "ctrlc"
version = "3.4.1"
@ -2684,6 +2694,15 @@ version = "0.2.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
[[package]]
name = "libc-print"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17f111e2175c779daaf5e89fe3a3b0776b0adec218bc1159c56e4d3f58032f5"
dependencies = [
"libc",
]
[[package]]
name = "libloading"
version = "0.7.4"
@ -5518,18 +5537,22 @@ name = "veilid-flutter"
version = "0.2.4"
dependencies = [
"allo-isolate",
"android_log-sys 0.3.1",
"async-std",
"backtrace",
"cfg-if 1.0.0",
"ctor",
"data-encoding",
"ffi-support",
"futures-util",
"hostname",
"jni",
"lazy_static",
"libc-print",
"opentelemetry",
"opentelemetry-otlp",
"opentelemetry-semantic-conventions",
"oslog",
"paranoid-android",
"parking_lot 0.12.1",
"serde",

View File

@ -140,7 +140,7 @@ impl RoutingDomainEditor {
log_rtab!(debug "[{:?}] COMMIT: {:?}", self.routing_domain, self.changes);
// Apply changes
let mut changed = false;
let mut peer_info_changed = false;
{
let mut inner = self.routing_table.inner.write();
inner.with_routing_domain_mut(self.routing_domain, |detail| {
@ -167,22 +167,21 @@ impl RoutingDomainEditor {
detail
.common_mut()
.clear_dial_info_details(address_type, protocol_type);
changed = true;
peer_info_changed = true;
}
RoutingDomainChange::ClearRelayNode => {
info!("[{:?}] cleared relay node", self.routing_domain);
detail.common_mut().set_relay_node(None);
changed = true;
peer_info_changed = true;
}
RoutingDomainChange::SetRelayNode { relay_node } => {
info!("[{:?}] set relay node: {}", self.routing_domain, relay_node);
detail.common_mut().set_relay_node(Some(relay_node.clone()));
changed = true;
peer_info_changed = true;
}
RoutingDomainChange::SetRelayNodeKeepalive { ts } => {
debug!("[{:?}] relay node keepalive: {:?}", self.routing_domain, ts);
detail.common_mut().set_relay_node_last_keepalive(ts);
changed = true;
}
RoutingDomainChange::AddDialInfoDetail { dial_info_detail } => {
info!(
@ -195,7 +194,7 @@ impl RoutingDomainEditor {
.common_mut()
.add_dial_info_detail(dial_info_detail.clone());
changed = true;
peer_info_changed = true;
}
RoutingDomainChange::SetupNetwork {
outbound_protocols,
@ -229,7 +228,7 @@ impl RoutingDomainEditor {
address_types,
capabilities.clone(),
);
changed = true;
peer_info_changed = true;
}
}
RoutingDomainChange::SetNetworkClass { network_class } => {
@ -246,19 +245,19 @@ impl RoutingDomainEditor {
info!("[{:?}] cleared network class", self.routing_domain,);
}
detail.common_mut().set_network_class(network_class);
changed = true;
peer_info_changed = true;
}
}
}
}
});
if changed {
if peer_info_changed {
// Allow signed node info updates at same timestamp for otherwise dead nodes if our network has changed
inner.reset_all_updated_since_last_network_change();
}
}
// Clear the routespecstore cache if our PublicInternet dial info has changed
if changed && self.routing_domain == RoutingDomain::PublicInternet {
if peer_info_changed && self.routing_domain == RoutingDomain::PublicInternet {
let rss = self.routing_table.route_spec_store();
rss.reset();
}

View File

@ -29,17 +29,17 @@ rt-tokio = [
[dependencies]
veilid-core = { path = "../../veilid-core", default-features = false }
tracing = { version = "^0", features = ["log", "attributes"] }
tracing-subscriber = "^0"
parking_lot = "^0"
backtrace = "^0"
serde_json = "^1"
serde = "^1"
futures-util = { version = "^0", default-features = false, features = [
tracing = { version = "0.1.37", features = ["log", "attributes"] }
tracing-subscriber = "0.3.17"
parking_lot = "0.12.1"
backtrace = "0.3.69"
serde_json = "1.0.107"
serde = "1.0.188"
futures-util = { version = "0.3.28", default-features = false, features = [
"alloc",
] }
cfg-if = "^1"
data-encoding = { version = "^2" }
cfg-if = "1.0.0"
data-encoding = { version = "2.4.0" }
# Dependencies for native builds only
# Linux, Windows, Mac, iOS, Android
@ -48,19 +48,28 @@ tracing-opentelemetry = "0.21"
opentelemetry = { version = "0.20" }
opentelemetry-otlp = { version = "0.13" }
opentelemetry-semantic-conventions = "0.12"
async-std = { version = "^1", features = ["unstable"], optional = true }
tokio = { version = "^1", features = ["full"], optional = true }
tokio-stream = { version = "^0", features = ["net"], optional = true }
tokio-util = { version = "^0", features = ["compat"], optional = true }
allo-isolate = "^0"
ffi-support = "^0"
lazy_static = "^1"
hostname = "^0"
async-std = { version = "1.12.0", features = ["unstable"], optional = true }
tokio = { version = "1.32.0", features = ["full"], optional = true }
tokio-stream = { version = "0.1.14", features = ["net"], optional = true }
tokio-util = { version = "0.7.8", features = ["compat"], optional = true }
allo-isolate = "0.1.20"
ffi-support = "0.4.4"
lazy_static = "1.4.0"
hostname = "0.3.1"
# loader debugging
ctor = "0.2.5"
libc-print = "0.1.22"
# Dependencies for WASM builds only
[target.'cfg(target_arch = "wasm32")'.dependencies]
# Dependencies for Android builds only
[target.'cfg(target_os = "android")'.dependencies]
jni = "^0"
jni = "0.21.1"
paranoid-android = "0.2.1"
android_log-sys = "0.3.1"
# Dependencies for Android builds only
[target.'cfg(target_os = "ios")'.dependencies]
oslog = { version = "0.2.0", default-features = false }

File diff suppressed because it is too large Load Diff