Ver código fonte

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 4 anos atrás
pai
commit
4603b5b2dd
1 arquivos alterados com 1 adições e 1 exclusões
  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 {