mirror of
https://github.com/taigrr/go-fastping
synced 2025-01-18 05:03:15 -08:00
fix close connection && fix sleep in chan
This commit is contained in:
parent
56843b1f9f
commit
13ddfb32b1
10
fastping.go
10
fastping.go
@ -484,7 +484,15 @@ func (p *Pinger) recvICMP(conn *net.IPConn, recv chan<- *packet, ctx *context, w
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.debugln("recvICMP(): p.recv <- packet")
|
p.debugln("recvICMP(): p.recv <- packet")
|
||||||
recv <- &packet{bytes: bytes, addr: ra}
|
|
||||||
|
select {
|
||||||
|
case recv <- &packet{bytes: bytes, addr: ra}:
|
||||||
|
case <-ctx.stop:
|
||||||
|
p.debugln("recvICMP(): <-ctx.stop")
|
||||||
|
wg.Done()
|
||||||
|
p.debugln("recvICMP(): wg.Done()")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user