Don't CheckInFlightPackets if PacketTimeout is the max

This commit is contained in:
Hampton Moore
2021-08-27 12:07:31 -04:00
committed by thatmattlove
parent 53e42bb95c
commit 9e634db39b

View File

@@ -77,6 +77,7 @@ const (
trackerLength = len(uuid.UUID{})
protocolICMP = 1
protocolIPv6ICMP = 58
maxPacketTimeout = time.Duration(math.MaxInt64)
)
var (
@@ -522,6 +523,9 @@ func (p *Pinger) runLoop(
func (p *Pinger) CheckInFlightPackets() {
// Loop through each item in map
if p.PacketTimeout == maxPacketTimeout {
return
}
currentTime := time.Now()
for seq, pkt := range p.InFlightPackets {
if pkt.DispatchedTime.Add(p.PacketTimeout).Before(currentTime) {