mirror of
https://github.com/go-ping/ping.git
synced 2025-09-19 17:26:35 +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{})
|
trackerLength = len(uuid.UUID{})
|
||||||
protocolICMP = 1
|
protocolICMP = 1
|
||||||
protocolIPv6ICMP = 58
|
protocolIPv6ICMP = 58
|
||||||
|
maxPacketTimeout = time.Duration(math.MaxInt64)
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -522,6 +523,9 @@ func (p *Pinger) runLoop(
|
|||||||
|
|
||||||
func (p *Pinger) CheckInFlightPackets() {
|
func (p *Pinger) CheckInFlightPackets() {
|
||||||
// Loop through each item in map
|
// Loop through each item in map
|
||||||
|
if p.PacketTimeout == maxPacketTimeout {
|
||||||
|
return
|
||||||
|
}
|
||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
for seq, pkt := range p.InFlightPackets {
|
for seq, pkt := range p.InFlightPackets {
|
||||||
if pkt.DispatchedTime.Add(p.PacketTimeout).Before(currentTime) {
|
if pkt.DispatchedTime.Add(p.PacketTimeout).Before(currentTime) {
|
||||||
|
Reference in New Issue
Block a user