Skip to content

Commit

Permalink
add function to get the distance between routers
Browse files Browse the repository at this point in the history
  • Loading branch information
tiborschneider committed Oct 7, 2024
1 parent d780bda commit 0c2d8d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bgpsim/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bgpsim"
version = "0.17.6"
version = "0.17.7"
edition = "2021"
license-file = "LICENSE"
description = "A network control-plane simulator"
Expand Down
5 changes: 5 additions & 0 deletions bgpsim/src/event/rand_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ impl<P: Prefix> GeoTimingModel<P> {
self.processing_params.insert(router, params);
}

/// Get the distance between two routers
pub fn get_distance(&mut self, src: RouterId, dst: RouterId) -> Option<f64> {
self.distances.get(&(src, dst)).map(|x| x.into_inner())
}

/// Set the distance between two nodes in light seconds
pub fn set_distance(&mut self, src: RouterId, dst: RouterId, dist: f64) {
let dist = NotNan::new(dist).unwrap();
Expand Down

0 comments on commit 0c2d8d5

Please sign in to comment.