Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Conversation

kylecarbs
Copy link
Member

No description provided.

@kylecarbs kylecarbs requested a review from deansheather July 9, 2021 04:32
go func() {
_ = dialer.Close()
}()
<-dialer.Closed()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do a select against a timer here so we can ensure it closes quickly

wsnet/dial.go Outdated
Comment on lines 143 to 146
if !d.closed {
d.closed = true
close(d.closedChan)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having a bool have a select with a default:

select {
  case <-d.closedChan:
    return
  default:
}

close(d.closedChan)

@kylecarbs kylecarbs enabled auto-merge (squash) July 9, 2021 04:43
@kylecarbs kylecarbs merged commit 7f3cd28 into master Jul 9, 2021
@kylecarbs kylecarbs deleted the closed branch July 9, 2021 04:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants