Skip to content

Commit

Permalink
fixup! fix: avoid data race for PacketsSent
Browse files Browse the repository at this point in the history
Signed-off-by: Per Hallgren <[email protected]>
  • Loading branch information
perhallgren committed Feb 3, 2025
1 parent 6431d86 commit b6ccd59
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,9 @@ func (p *Pinger) processPacket(recv *packet) error {
inPkt.Seq = pkt.Seq
// If we've already received this sequence, ignore it.
if _, inflight := p.awaitingSequences[*pktUUID][pkt.Seq]; !inflight {
p.statsMu.Lock()
p.PacketsRecvDuplicates++
p.statsMu.Unlock()
if p.OnDuplicateRecv != nil {
p.OnDuplicateRecv(inPkt)
}
Expand Down

0 comments on commit b6ccd59

Please sign in to comment.