From 287bab744da5c256845f49f6d9f76028ba5f08ef Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 16 Jun 2025 17:41:16 +0200 Subject: [PATCH] More fine-granular timer updates --- boringtun/src/noise/timers.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/boringtun/src/noise/timers.rs b/boringtun/src/noise/timers.rs index fe8f953bc..65ed9e6d7 100644 --- a/boringtun/src/noise/timers.rs +++ b/boringtun/src/noise/timers.rs @@ -3,6 +3,7 @@ use super::errors::WireGuardError; use crate::noise::{Tunn, TunnResult, N_SESSIONS}; +use std::iter; use std::ops::{Index, IndexMut}; use rand::Rng; @@ -376,7 +377,10 @@ impl Tunn { /// /// If this returns `None`, you may call it at your usual desired precision (usually once a second is enough). pub fn next_timer_update(&self) -> Option { - self.timers.send_handshake_at + iter::empty() + .chain(self.timers.send_handshake_at) + .chain(self.timers.want_passive_keepalive_at) + .min() } #[deprecated(note = "Prefer `Tunn::time_since_last_handshake_at` to avoid time-impurity")]