From 4603b5b2dd180de8f72ca874baa787070a17d325 Mon Sep 17 00:00:00 2001 From: Wade Simmons Date: Fri, 26 Mar 2021 15:01:05 -0400 Subject: [PATCH] fix PromoteEvery check (#424) This check was accidentally typo'd in #396 from `%` to `&`. Restore the correct functionality here (we want to do the check every "PromoteEvery" count packets). --- hostmap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hostmap.go b/hostmap.go index b718ee5..6dc0fec 100644 --- a/hostmap.go +++ b/hostmap.go @@ -476,7 +476,7 @@ func (i *HostInfo) TryPromoteBest(preferredRanges []*net.IPNet, ifce *Interface) return } - if atomic.AddUint32(&i.promoteCounter, 1)&PromoteEvery == 0 { + if atomic.AddUint32(&i.promoteCounter, 1)%PromoteEvery == 0 { // return early if we are already on a preferred remote rIP := i.remote.IP for _, l := range preferredRanges {