summaryrefslogtreecommitdiffhomepage
path: root/device/receive.go
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2019-06-03 15:46:46 -0400
committerJason A. Donenfeld <Jason@zx2c4.com>2019-06-03 22:15:41 +0200
commit18b6627f33883e28dd69b2990c52359002856694 (patch)
treefc1f4ba5ac62252eddfab68de391dcf89d1edce7 /device/receive.go
parent80ef2a42e66a9cb57f806ca49361b9e2a5e6c45f (diff)
device, ratelimiter: replace uses of time.Now().Sub() with time.Since()
Simplification found by staticcheck: $ staticcheck ./... | grep S1012 device/cookie.go:90:5: should use time.Since instead of time.Now().Sub (S1012) device/cookie.go:127:5: should use time.Since instead of time.Now().Sub (S1012) device/cookie.go:242:5: should use time.Since instead of time.Now().Sub (S1012) device/noise-protocol.go:304:13: should use time.Since instead of time.Now().Sub (S1012) device/receive.go:82:46: should use time.Since instead of time.Now().Sub (S1012) device/send.go:132:5: should use time.Since instead of time.Now().Sub (S1012) device/send.go:139:5: should use time.Since instead of time.Now().Sub (S1012) device/send.go:235:59: should use time.Since instead of time.Now().Sub (S1012) device/send.go:393:9: should use time.Since instead of time.Now().Sub (S1012) ratelimiter/ratelimiter.go:79:10: should use time.Since instead of time.Now().Sub (S1012) ratelimiter/ratelimiter.go:87:10: should use time.Since instead of time.Now().Sub (S1012) Change applied using: $ find . -type f -name "*.go" -exec sed -i "s/Now().Sub(/Since(/g" {} \; Signed-off-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to 'device/receive.go')
-rw-r--r--device/receive.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/device/receive.go b/device/receive.go
index 22870f2..32d632b 100644
--- a/device/receive.go
+++ b/device/receive.go
@@ -79,7 +79,7 @@ func (peer *Peer) keepKeyFreshReceiving() {
return
}
keypair := peer.keypairs.Current()
- if keypair != nil && keypair.isInitiator && time.Now().Sub(keypair.created) > (RejectAfterTime-KeepaliveTimeout-RekeyTimeout) {
+ if keypair != nil && keypair.isInitiator && time.Since(keypair.created) > (RejectAfterTime-KeepaliveTimeout-RekeyTimeout) {
peer.timers.sentLastMinuteHandshake.Set(true)
peer.SendHandshakeInitiation(false)
}