From 9e634db39badfb303756ed464626e62b180f50a0 Mon Sep 17 00:00:00 2001 From: Hampton Moore Date: Fri, 27 Aug 2021 12:07:31 -0400 Subject: [PATCH] Don't CheckInFlightPackets if PacketTimeout is the max --- ping.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ping.go b/ping.go index 1aae564..6b2c275 100644 --- a/ping.go +++ b/ping.go @@ -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) {