diff --git a/ping/destination.go b/ping/destination.go index 7f629061..61aadddf 100644 --- a/ping/destination.go +++ b/ping/destination.go @@ -88,7 +88,7 @@ func (d *Destination) loopRead() { err = d.conn.ReadIP(buffer) if err != nil { buffer.Release() - if !E.IsClosed(err) { + if !E.IsClosedOrCanceled(err) { d.logger.ErrorContext(d.ctx, E.Cause(err, "receive ICMP echo reply")) } return diff --git a/ping/destination_gvisor.go b/ping/destination_gvisor.go index 85496c6c..449504f0 100644 --- a/ping/destination_gvisor.go +++ b/ping/destination_gvisor.go @@ -101,7 +101,7 @@ func (d *GVisorDestination) loopRead() { n, err := d.conn.Read(buffer.FreeBytes()) if err != nil { buffer.Release() - if !E.IsClosed(err) { + if !E.IsClosedOrCanceled(err) { d.logger.ErrorContext(d.ctx, E.Cause(err, "receive ICMP echo reply")) } return