diff options
Diffstat (limited to '')
-rw-r--r-- | src/wireguard/timers.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wireguard/timers.rs b/src/wireguard/timers.rs index 485f466..22a0ff1 100644 --- a/src/wireguard/timers.rs +++ b/src/wireguard/timers.rs @@ -124,14 +124,28 @@ impl<B: bind::Bind> PeerInner<B> { self.timers_any_authenticated_packet_sent(); } + + pub fn set_persistent_keepalive_interval(&self, interval: usize) { + self.timers().send_persistent_keepalive.stop(); + self.keepalive.store(interval, Ordering::SeqCst); + if interval > 0 { + self.timers() + .send_persistent_keepalive + .start(Duration::from_secs(interval as u64)); + } + } + fn packet_send_queued_handshake_initiation(&self, is_retry: bool) { if !is_retry { self.timers().handshake_attempts.store(0, Ordering::SeqCst); } self.packet_send_handshake_initiation(); } + + } + impl Timers { pub fn new<T, B>(runner: &Runner, peer: Peer<T, B>) -> Timers where |