Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: create Happy Eyeballs dialer #176
feat: create Happy Eyeballs dialer #176
Changes from all commits
3ae0bb8
1d333af
22bac5b
62574b6
4496491
0a4b5fb
ce64110
e59c065
0b15a13
74f2ab3
58df38e
6d8ba93
dd3632e
29f849b
57787d8
48e3ae7
f13cf4b
4fddce3
55cdc26
dc1c999
623ba3d
2580371
c0602e6
e941cab
12d6105
26a786f
52842bb
7fe0ec9
34209a9
de32e39
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I mean we did not do anything special with
dialDone
in the last review. Why not just simply using thectx
parameter directly in the code below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no guarantee that the input context will be cancelled. In this code, I cancel the context to make sure all subtasks are notifed and can complete.
If I remove the
dialDone
, the subtasks may hang for a while.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit it seems this is the only place
newClosedChan()
is used. Maybe we can simplifyclose
the channel here and deletenewClosedChan
function to save some lines?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your code doesn't work because
attemptDelayCh
must be of type<-chan struct{}
, notchan struct{}
, otherwise the assignmentattemptDelayCh = waitCtx.Done()
doesn't compile.Instead of creating a channel, closing, and then assigning to
attemptDelayCh
, I found it better to keep that logic out of the core logic, which is already complicated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SG, maybe
var attemptDelayCh <-chan struct{} = make(chan struct{})
would work here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that too 😅
The problem is that you can't close a read-only channel.