Skip to content

Client RunContext #74

Description

@tehzwen

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()
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions