mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-25 23:39:22 -05:00
disable profiling
correct hop count
This commit is contained in:
parent
26311e96c5
commit
65dede4c75
@ -1285,6 +1285,8 @@ impl RouteSpecStore {
|
||||
safety_selection: SafetySelection,
|
||||
mut private_route: PrivateRoute,
|
||||
) -> EyreResult<Option<CompiledRoute>> {
|
||||
// let profile_start_ts = get_timestamp();
|
||||
|
||||
let inner = &mut *self.inner.lock();
|
||||
let routing_table = self.unlocked_inner.routing_table.clone();
|
||||
let rti = &mut *routing_table.inner.write();
|
||||
@ -1327,6 +1329,7 @@ impl RouteSpecStore {
|
||||
first_hop.set_sequencing(sequencing);
|
||||
|
||||
// Return the compiled safety route
|
||||
//println!("compile_safety_route profile (stub): {} us", (get_timestamp() - profile_start_ts));
|
||||
return Ok(Some(CompiledRoute {
|
||||
safety_route: SafetyRoute::new_stub(routing_table.node_id(), private_route),
|
||||
secret: routing_table.node_id_secret(),
|
||||
@ -1380,6 +1383,7 @@ impl RouteSpecStore {
|
||||
first_hop,
|
||||
};
|
||||
// Return compiled route
|
||||
//println!("compile_safety_route profile (cached): {} us", (get_timestamp() - profile_start_ts));
|
||||
return Ok(Some(compiled_route));
|
||||
}
|
||||
}
|
||||
@ -1498,6 +1502,7 @@ impl RouteSpecStore {
|
||||
};
|
||||
|
||||
// Return compiled route
|
||||
//println!("compile_safety_route profile (uncached): {} us", (get_timestamp() - profile_start_ts));
|
||||
Ok(Some(compiled_route))
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,11 @@ fn get_route_id(rss: RouteSpecStore) -> impl Fn(&str) -> Option<DHTKey> {
|
||||
};
|
||||
}
|
||||
|
||||
fn get_safety_selection(text: &str, rss: RouteSpecStore) -> Option<SafetySelection> {
|
||||
fn get_safety_selection(text: &str, routing_table: RoutingTable) -> Option<SafetySelection> {
|
||||
let rss = routing_table.route_spec_store();
|
||||
let default_route_hop_count =
|
||||
routing_table.with_config(|c| c.network.rpc.default_route_hop_count as usize);
|
||||
|
||||
if text.len() != 0 && &text[0..1] == "-" {
|
||||
// Unsafe
|
||||
let text = &text[1..];
|
||||
@ -62,7 +66,7 @@ fn get_safety_selection(text: &str, rss: RouteSpecStore) -> Option<SafetySelecti
|
||||
} else {
|
||||
// Safe
|
||||
let mut preferred_route = None;
|
||||
let mut hop_count = 2;
|
||||
let mut hop_count = default_route_hop_count;
|
||||
let mut stability = Stability::default();
|
||||
let mut sequencing = Sequencing::default();
|
||||
for x in text.split(",") {
|
||||
@ -111,7 +115,7 @@ fn get_destination(routing_table: RoutingTable) -> impl FnOnce(&str) -> Option<D
|
||||
move |text| {
|
||||
// Safety selection
|
||||
let (text, ss) = if let Some((first, second)) = text.split_once('+') {
|
||||
let ss = get_safety_selection(second, routing_table.route_spec_store())?;
|
||||
let ss = get_safety_selection(second, routing_table.clone())?;
|
||||
(first, Some(ss))
|
||||
} else {
|
||||
(text, None)
|
||||
|
Loading…
Reference in New Issue
Block a user