diag: drain ping reply channel to avoid goroutine leak

This commit is contained in:
Michael Stapelberg 2020-09-14 22:10:09 +02:00
parent 99c4046ebf
commit a8fce3cbbc

View File

@ -278,6 +278,11 @@ func (d *ping6) Evaluate() (string, error) {
if localAddr[reply.Address.String()] {
continue
}
go func() {
for range replies {
// drain channel
}
}()
return formatRTT(reply.Duration) + " from " + reply.Address.String(), nil
}
return "", fmt.Errorf("no responses to %s within %v", addr, timeout)