aboutsummaryrefslogtreecommitdiffstats
path: root/timers.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-04-18 07:24:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-04-18 07:24:33 +0200
commiteb6728400ba656990aa4518dc4f5f2a6f0f19f8e (patch)
tree07582cbeda3eee2c9d0c75b03e635ff598793665 /timers.go
parentAlign 64-bit atomics (diff)
downloadwireguard-go-eb6728400ba656990aa4518dc4f5f2a6f0f19f8e.tar.xz
wireguard-go-eb6728400ba656990aa4518dc4f5f2a6f0f19f8e.zip
Use simple 16-bit integer for persistent keepalive
Races for this aren't a huge problem.
Diffstat (limited to '')
-rw-r--r--timers.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/timers.go b/timers.go
index 76dffb9..e118c38 100644
--- a/timers.go
+++ b/timers.go
@@ -105,7 +105,7 @@ func (peer *Peer) TimerAnyAuthenticatedPacketReceived() {
* Push persistent keep-alive into the future
*/
func (peer *Peer) TimerAnyAuthenticatedPacketTraversal() {
- interval := atomic.LoadUint64(&peer.persistentKeepaliveInterval)
+ interval := peer.persistentKeepaliveInterval
if interval > 0 {
duration := time.Duration(interval) * time.Second
peer.timer.keepalivePersistent.Reset(duration)
@@ -199,7 +199,7 @@ func (peer *Peer) RoutineTimerHandler() {
peer.timer.handshakeNew.Stop()
peer.timer.zeroAllKeys.Stop()
- interval := atomic.LoadUint64(&peer.persistentKeepaliveInterval)
+ interval := peer.persistentKeepaliveInterval
if interval > 0 {
duration := time.Duration(interval) * time.Second
peer.timer.keepalivePersistent.Reset(duration)
@@ -225,7 +225,7 @@ func (peer *Peer) RoutineTimerHandler() {
case <-peer.timer.keepalivePersistent.Wait():
- interval := atomic.LoadUint64(&peer.persistentKeepaliveInterval)
+ interval := peer.persistentKeepaliveInterval
if interval > 0 {
logDebug.Println(peer.String(), ": Send keep-alive (persistent)")
peer.timer.keepalivePassive.Stop()