pro-bing
pro-bing copied to clipboard
func `RunWithContext` didn't exit as expected
// RunWithContext runs the pinger with a context. This is a blocking function that will exit when it's
// done or if the context is canceled. If Count or Interval are not specified, it will run continuously until
// it is interrupted.
func (p *Pinger) RunWithContext(ctx context.Context) error {
...
if p.ipaddr == nil {
err = p.Resolve()
}
...
return p.run(ctx, conn)
}
function RunWithContext didn't exit as expected as it will block in p.Resolve(), it didn't exit even when ctx is canceled before it was passed in
A workaround is to use p.ResolveTimeout for the moment, yet IMHO this should be fixed to use resolve using the passed context.