diff --git a/src/coord.rs b/src/coord.rs index d90caf8..95b318d 100644 --- a/src/coord.rs +++ b/src/coord.rs @@ -236,7 +236,7 @@ where /// Panics if any: /// /// - `rtt <= 0.0` - /// - This coordinate's AND the other's error estimate `<= 0.0` + /// - This coordinate's OR the other's error estimate `<= 0.0` pub fn update_until(&mut self, rtt: f64, other: &Coord, threshold: f64, cfg: &Config) { // TODO: dont go negative let low = rtt - threshold; @@ -263,11 +263,9 @@ where /// Panics if any: /// /// - `rtt <= 0.0` - /// - This coordinate's AND the other's error estimate `<= 0.0` + /// - This coordinate's OR the other's error estimate `<= 0.0` pub fn update(&mut self, rtt: f64, other: &Coord, cfg: &Config) { - // @TODO assert or Err()? - assert!(self.error_estimate > 0.0 || other.error_estimate > 0.0); - assert!(rtt > 0.0); + assert!(self.error_estimate > 0.0 && other.error_estimate > 0.0 && rtt > 0.0); // Sample weight balances local and other error // - A high local error = greater movement diff --git a/src/node.rs b/src/node.rs index 0a2f6d2..2d30375 100644 --- a/src/node.rs +++ b/src/node.rs @@ -207,7 +207,7 @@ where /// Panics if any: /// /// - `rtt <= 0.0` - /// - This coordinate's AND the other's error estimate `<= 0.0` + /// - This coordinate's OR the other's error estimate `<= 0.0` pub fn update_until(&mut self, rtt: Duration, other: &Coord, threshold: f64) { self.coord.update_until( f64::max(f64::MIN_POSITIVE, rtt.as_secs_f64()), @@ -274,7 +274,7 @@ where /// /// Panics if any: /// - /// - This coordinate's AND the remote's error estimate `<= 0.0` + /// - This coordinate's OR the remote's error estimate `<= 0.0` pub fn update(&mut self, rtt: Duration, other: &Coord) -> bool { let coord = self.coord.clone(); if let Err(Error {