-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
net: wrap connect in nextTick #2054
Conversation
EDIT: No longer applicable. |
This is more costly than simply putting the connect in a nextTick. |
@trevnorris yea, good point. Updated to just wrap |
LGTM |
LGTM For reference it could have also been done as process.nextTick(connect, self, host, port, addressType, localAddress, localPort); But I'm fairly certain it would be slower this way. So don't change how you currently have it. |
Oh, is there a test we could add for the edge case regression? |
I was trying to think of a way to test that... The only case I've seen has been changing the server's IP address and then continuing to attempt to make a request to the old one. I was able to reproduce fairly consistently using https://gist.github.com/m0ppers/3709f7d87b73be9aca7b and changing my IP |
I haven't been able to write a test that exhibits the exact same behavior each time for my local machine. It happens when a |
@evanlucas I've tried myself. Can't figure out a way to do it from a simple test script. So we won't worry about it. |
Fixes an edge case regression introduced in 1bef717. With the lookup being skipped, an error could be emitted before an error listener has been added. An example of this was presented by changing the server’s IP address and then immediately making a request to the old address. Related: nodejs#1823 PR-URL: nodejs#2054 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Thanks, landed in af249fa |
Fixes an edge case regression introduced in 1bef717. With the lookup being skipped, an error could be emitted before an error listener has been added. An example of this was presented by changing the server’s IP address and then immediately making a request to the old address. Related: nodejs#1823 PR-URL: nodejs#2054 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Fixes an edge case regression introduced in
1bef717.
With the lookup being skipped, an error could be emitted before and
error listener has been added.
An example of this was presented by changing the server’s IP address
and then immediately making a request to the old address.
Related: #1823