Skip to content

Commit

Permalink
Expose next_timer_update
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Jan 8, 2025
1 parent 5627d7e commit 03d2921
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions boringtun/src/noise/timers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,13 @@ impl Tunn {
TunnResult::Done
}

/// Returns an [`Instant`] when [`Tunn::update_timers_at`] should be called again.
///
/// 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<Instant> {
self.timers.send_handshake_at
}

#[deprecated(note = "Prefer `Tunn::time_since_last_handshake_at` to avoid time-impurity")]
pub fn time_since_last_handshake(&self) -> Option<Duration> {
self.time_since_last_handshake_at(Instant::now())
Expand Down

0 comments on commit 03d2921

Please sign in to comment.