mirror of
https://github.com/go-ping/ping.git
synced 2025-09-18 16:34:25 +00:00
Don't CheckInFlightPackets if PacketTimeout is the max
This commit is contained in:
committed by
thatmattlove
parent
53e42bb95c
commit
9e634db39b
4
ping.go
4
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) {
|
||||
|
Reference in New Issue
Block a user