Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

func RunWithContext didn't exit as expected #64

Open
ruokeqx opened this issue Sep 5, 2023 · 1 comment
Open

func RunWithContext didn't exit as expected #64

ruokeqx opened this issue Sep 5, 2023 · 1 comment

Comments

@ruokeqx
Copy link

ruokeqx commented Sep 5, 2023

// 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

@thediveo
Copy link

thediveo commented Apr 22, 2024

A workaround is to use p.ResolveTimeout for the moment, yet IMHO this should be fixed to use resolve using the passed context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants