diff --git a/ping.go b/ping.go index f226933..9d5f106 100644 --- a/ping.go +++ b/ping.go @@ -471,7 +471,11 @@ func (p *Pinger) recvICMP( } } - recv <- &packet{bytes: bytes, nbytes: n, ttl: ttl} + select { + case <-p.done: + return + case recv <- &packet{bytes: bytes, nbytes: n, ttl: ttl}: + } } } }