diff --git a/.vscode/settings.json b/.vscode/settings.json index d0656d37..b8e1d92b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,4 +3,9 @@ "python.analysis.extraPaths": [ "veilid-python/.venv/lib/python3.11/site-packages" ], + "rust-analyzer.linkedProjects": [ + "./veilid-core/Cargo.toml", + "./veilid-core/Cargo.toml", + "./veilid-core/Cargo.toml" + ], } \ No newline at end of file diff --git a/veilid-core/src/network_manager/native/mod.rs b/veilid-core/src/network_manager/native/mod.rs index c469ed13..cf04b50a 100644 --- a/veilid-core/src/network_manager/native/mod.rs +++ b/veilid-core/src/network_manager/native/mod.rs @@ -865,15 +865,19 @@ impl Network { debug!("clearing dial info"); - let mut editor = routing_table.edit_routing_domain(RoutingDomain::PublicInternet); - editor.clear_dial_info_details(); - editor.set_network_class(None); - editor.commit(); + routing_table + .edit_routing_domain(RoutingDomain::PublicInternet) + .clear_dial_info_details() + .set_network_class(None) + .clear_relay_node() + .commit(); - let mut editor = routing_table.edit_routing_domain(RoutingDomain::LocalNetwork); - editor.clear_dial_info_details(); - editor.set_network_class(None); - editor.commit(); + routing_table + .edit_routing_domain(RoutingDomain::LocalNetwork) + .clear_dial_info_details() + .set_network_class(None) + .clear_relay_node() + .commit(); // Reset state including network class *self.inner.lock() = Self::new_inner(); diff --git a/veilid-core/src/network_manager/native/network_class_discovery.rs b/veilid-core/src/network_manager/native/network_class_discovery.rs index 6fdf283a..0b13c521 100644 --- a/veilid-core/src/network_manager/native/network_class_discovery.rs +++ b/veilid-core/src/network_manager/native/network_class_discovery.rs @@ -933,6 +933,7 @@ impl Network { // Network class could not be determined editor.clear_dial_info_details(); editor.set_network_class(None); + editor.clear_relay_node(); changed = true; log_net!(debug "PublicInternet network class cleared"); } diff --git a/veilid-core/src/network_manager/wasm/mod.rs b/veilid-core/src/network_manager/wasm/mod.rs index 77111b3a..dcdd0f85 100644 --- a/veilid-core/src/network_manager/wasm/mod.rs +++ b/veilid-core/src/network_manager/wasm/mod.rs @@ -334,10 +334,13 @@ impl Network { let routing_table = self.routing_table(); // Drop all dial info - let mut editor = routing_table.edit_routing_domain(RoutingDomain::PublicInternet); - editor.clear_dial_info_details(); - editor.set_network_class(None); - editor.commit().await; + routing_table + .edit_routing_domain(RoutingDomain::PublicInternet) + .clear_dial_info_details() + .set_network_class(None) + .clear_relay_node() + .commit() + .await; // Cancels all async background tasks by dropping join handles *self.inner.lock() = Self::new_inner(); diff --git a/veilid-core/src/routing_table/tasks/relay_management.rs b/veilid-core/src/routing_table/tasks/relay_management.rs index 37ddab6c..874200d6 100644 --- a/veilid-core/src/routing_table/tasks/relay_management.rs +++ b/veilid-core/src/routing_table/tasks/relay_management.rs @@ -9,10 +9,6 @@ impl RoutingTable { _last_ts: Timestamp, cur_ts: Timestamp, ) -> EyreResult<()> { - // Get our node's current node info and network class and do the right thing - if !self.has_valid_network_class(RoutingDomain::PublicInternet) { - return Ok(()); - } let own_peer_info = self.get_own_peer_info(RoutingDomain::PublicInternet); let own_node_info = own_peer_info.signed_node_info().node_info(); let network_class = own_node_info.network_class(); @@ -48,6 +44,15 @@ impl RoutingTable { ); editor.clear_relay_node(); false + } + // Should not have relay for invalid network class + else if !self.has_valid_network_class(RoutingDomain::PublicInternet) { + info!( + "Invalid network class does not get a relay, dropping relay {}", + relay_node + ); + editor.clear_relay_node(); + false } else { true }