aboutsummaryrefslogtreecommitdiffstats
path: root/src/wireguard
diff options
context:
space:
mode:
Diffstat (limited to 'src/wireguard')
-rw-r--r--src/wireguard/peer.rs2
-rw-r--r--src/wireguard/timers.rs2
-rw-r--r--src/wireguard/wireguard.rs4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/wireguard/peer.rs b/src/wireguard/peer.rs
index 7d95493..92844b6 100644
--- a/src/wireguard/peer.rs
+++ b/src/wireguard/peer.rs
@@ -30,7 +30,7 @@ pub struct PeerInner<T: Tun, B: Bind> {
pub wg: Arc<WireguardInner<T, B>>,
// handshake state
- pub walltime_last_handshake: Mutex<SystemTime>,
+ pub walltime_last_handshake: Mutex<Option<SystemTime>>,
pub last_handshake_sent: Mutex<Instant>, // instant for last handshake
pub handshake_queued: AtomicBool, // is a handshake job currently queued for the peer?
pub queue: Mutex<Sender<HandshakeJob<B::Endpoint>>>, // handshake queue
diff --git a/src/wireguard/timers.rs b/src/wireguard/timers.rs
index bfd2583..5eb69dc 100644
--- a/src/wireguard/timers.rs
+++ b/src/wireguard/timers.rs
@@ -139,7 +139,7 @@ impl<T: tun::Tun, B: bind::Bind> PeerInner<T, B> {
if timers.enabled {
timers.handshake_attempts.store(0, Ordering::SeqCst);
timers.sent_lastminute_handshake.store(false, Ordering::SeqCst);
- *self.walltime_last_handshake.lock() = SystemTime::now();
+ *self.walltime_last_handshake.lock() = Some(SystemTime::now());
}
}
diff --git a/src/wireguard/wireguard.rs b/src/wireguard/wireguard.rs
index e548c8a..eb43512 100644
--- a/src/wireguard/wireguard.rs
+++ b/src/wireguard/wireguard.rs
@@ -16,7 +16,7 @@ use std::ops::Deref;
use std::sync::atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread;
-use std::time::{Duration, Instant, SystemTime};
+use std::time::{Duration, Instant};
use std::collections::hash_map::Entry;
use std::collections::HashMap;
@@ -219,7 +219,7 @@ impl<T: Tun, B: Bind> Wireguard<T, B> {
id: rng.gen(),
pk,
wg: self.state.clone(),
- walltime_last_handshake: Mutex::new(SystemTime::UNIX_EPOCH),
+ walltime_last_handshake: Mutex::new(None),
last_handshake_sent: Mutex::new(self.state.start - TIME_HORIZON),
handshake_queued: AtomicBool::new(false),
queue: Mutex::new(self.state.queue.lock().clone()),