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

Client RunContext #74

Open
tehzwen opened this issue Jan 16, 2020 · 2 comments
Open

Client RunContext #74

tehzwen opened this issue Jan 16, 2020 · 2 comments

Comments

@tehzwen
Copy link

tehzwen commented Jan 16, 2020

Just wanted to make an issue here for some clarification, when using this library and running

ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()

//IRC CONFIG CODE HERE
client := irc.NewClient(conn, config)
err = client.RunContext(ctx)

if err != nil {
	log.Fatalln(err)
	panic(err)
}

The irc client doesn't cancel or close after the 3 seconds given to the context. Sorry if this is a dumb question I'm still fairly new to go contexts!

Thank you so much for the library, really been enjoying it.

Just as a sidenote, when I added the following code to client.go it exits the IRC client after the allotted time as expected.

	var err error
	select {
	case err = <-c.errChan:
	case <-ctx.Done():
		wg.Done()
	}
@belak
Copy link
Member

belak commented Jan 16, 2020

This probably means there's a bug somewhere. My guess is that the read loop isn't closing. I can try and take another look at this, since there's a bug around the read loop at the moment anyway.

@tehzwen
Copy link
Author

tehzwen commented Jan 16, 2020

Thanks for the prompt reply! I appreciate it! 👍

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