mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-11-21 16:37:39 -06:00
more semantics
This commit is contained in:
parent
e61d6be6a9
commit
4960d13447
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -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"
|
||||
],
|
||||
}
|
@ -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();
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user