mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-28 17:01:00 -06:00
fix #337
This commit is contained in:
parent
38cd29f9a1
commit
ee1472f3ae
@ -167,6 +167,7 @@ impl RouteSpecStore {
|
||||
/// Returns other errors on failure
|
||||
/// Returns Ok(route id string) on success
|
||||
#[instrument(level = "trace", skip(self), ret, err(level=Level::TRACE))]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn allocate_route(
|
||||
&self,
|
||||
crypto_kinds: &[CryptoKind],
|
||||
@ -175,6 +176,7 @@ impl RouteSpecStore {
|
||||
hop_count: usize,
|
||||
directions: DirectionSet,
|
||||
avoid_nodes: &[TypedKey],
|
||||
automatic: bool,
|
||||
) -> VeilidAPIResult<RouteId> {
|
||||
let inner = &mut *self.inner.lock();
|
||||
let routing_table = self.unlocked_inner.routing_table.clone();
|
||||
@ -189,6 +191,7 @@ impl RouteSpecStore {
|
||||
hop_count,
|
||||
directions,
|
||||
avoid_nodes,
|
||||
automatic,
|
||||
)
|
||||
}
|
||||
|
||||
@ -204,6 +207,7 @@ impl RouteSpecStore {
|
||||
hop_count: usize,
|
||||
directions: DirectionSet,
|
||||
avoid_nodes: &[TypedKey],
|
||||
automatic: bool,
|
||||
) -> VeilidAPIResult<RouteId> {
|
||||
use core::cmp::Ordering;
|
||||
|
||||
@ -576,6 +580,7 @@ impl RouteSpecStore {
|
||||
directions,
|
||||
stability,
|
||||
can_do_sequenced,
|
||||
automatic,
|
||||
);
|
||||
|
||||
// make id
|
||||
@ -1255,6 +1260,7 @@ impl RouteSpecStore {
|
||||
safety_spec.hop_count,
|
||||
direction,
|
||||
avoid_nodes,
|
||||
true,
|
||||
)?
|
||||
};
|
||||
|
||||
|
@ -29,6 +29,8 @@ pub(crate) struct RouteSetSpecDetail {
|
||||
can_do_sequenced: bool,
|
||||
/// Stats
|
||||
stats: RouteStats,
|
||||
/// Automatically allocated route vs manually allocated route
|
||||
automatic: bool,
|
||||
}
|
||||
|
||||
impl RouteSetSpecDetail {
|
||||
@ -39,6 +41,7 @@ impl RouteSetSpecDetail {
|
||||
directions: DirectionSet,
|
||||
stability: Stability,
|
||||
can_do_sequenced: bool,
|
||||
automatic: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
route_set,
|
||||
@ -48,6 +51,7 @@ impl RouteSetSpecDetail {
|
||||
stability,
|
||||
can_do_sequenced,
|
||||
stats: RouteStats::new(cur_ts),
|
||||
automatic,
|
||||
}
|
||||
}
|
||||
pub fn get_route_by_key(&self, key: &PublicKey) -> Option<&RouteSpecDetail> {
|
||||
@ -115,6 +119,9 @@ impl RouteSetSpecDetail {
|
||||
}
|
||||
false
|
||||
}
|
||||
pub fn is_automatic(&self) -> bool {
|
||||
self.automatic
|
||||
}
|
||||
|
||||
/// Generate a key for the cache that can be used to uniquely identify this route's contents
|
||||
pub fn make_cache_key(&self, rti: &RoutingTableInner) -> Vec<u8> {
|
||||
|
@ -110,8 +110,10 @@ impl RouteSpecStoreCache {
|
||||
self.invalidate_compiled_route_cache(pk);
|
||||
}
|
||||
|
||||
// Mark it as dead for the update
|
||||
self.dead_routes.push(id);
|
||||
// Mark it as dead for the update if it wasn't automatically created
|
||||
if !rssd.is_automatic() {
|
||||
self.dead_routes.push(id);
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
@ -219,6 +219,7 @@ impl RoutingTable {
|
||||
default_route_hop_count,
|
||||
DirectionSet::all(),
|
||||
&[],
|
||||
true,
|
||||
) {
|
||||
Err(VeilidAPIError::TryAgain { message }) => {
|
||||
log_rtab!(debug "Route allocation unavailable: {}", message);
|
||||
|
@ -270,6 +270,7 @@ impl VeilidAPI {
|
||||
default_route_hop_count,
|
||||
Direction::Inbound.into(),
|
||||
&[],
|
||||
false,
|
||||
)?;
|
||||
if !rss.test_route(route_id).await? {
|
||||
rss.release_route(route_id);
|
||||
|
@ -1095,6 +1095,7 @@ impl VeilidAPI {
|
||||
hop_count,
|
||||
directions,
|
||||
&[],
|
||||
false,
|
||||
) {
|
||||
Ok(v) => v.to_string(),
|
||||
Err(e) => {
|
||||
|
@ -27,82 +27,82 @@ pub fn setup() -> () {
|
||||
});
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_types() {
|
||||
// setup();
|
||||
// test_types::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_types() {
|
||||
setup();
|
||||
test_types::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_veilid_core() {
|
||||
// setup();
|
||||
// test_veilid_core::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_veilid_core() {
|
||||
setup();
|
||||
test_veilid_core::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_veilid_config() {
|
||||
// setup();
|
||||
// test_veilid_config::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_veilid_config() {
|
||||
setup();
|
||||
test_veilid_config::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_connection_table() {
|
||||
// setup();
|
||||
// test_connection_table::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_connection_table() {
|
||||
setup();
|
||||
test_connection_table::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_signed_node_info() {
|
||||
// setup();
|
||||
// test_signed_node_info::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_signed_node_info() {
|
||||
setup();
|
||||
test_signed_node_info::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_table_store() {
|
||||
// setup();
|
||||
// test_table_store::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_table_store() {
|
||||
setup();
|
||||
test_table_store::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_protected_store() {
|
||||
// setup();
|
||||
// test_protected_store::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_protected_store() {
|
||||
setup();
|
||||
test_protected_store::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_crypto() {
|
||||
// setup();
|
||||
// test_crypto::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_crypto() {
|
||||
setup();
|
||||
test_crypto::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_envelope_receipt() {
|
||||
// setup();
|
||||
// test_envelope_receipt::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_envelope_receipt() {
|
||||
setup();
|
||||
test_envelope_receipt::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_serialize_json() {
|
||||
// setup();
|
||||
// test_serialize_json::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_serialize_json() {
|
||||
setup();
|
||||
test_serialize_json::test_all().await;
|
||||
}
|
||||
|
||||
// #[wasm_bindgen_test]
|
||||
// #[serial]
|
||||
// async fn wasm_test_serialize_routing_table() {
|
||||
// setup();
|
||||
// test_serialize_routing_table::test_all().await;
|
||||
// }
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
async fn wasm_test_serialize_routing_table() {
|
||||
setup();
|
||||
test_serialize_routing_table::test_all().await;
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
#[serial]
|
||||
|
Loading…
Reference in New Issue
Block a user