Explorar o código

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).
Wade Simmons %!s(int64=4) %!d(string=hai) anos
pai
achega
4603b5b2dd
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      hostmap.go

+ 1 - 1
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 {