-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
http: fix deferToConnect comments #27876
Conversation
2f266db
to
d676912
Compare
Is it non-trivial to write a reliable test for this? |
I do not see what is the bug that you are trying to fix. Essentially, I do not know what behavior you would like to change. Neither this PR or #27875 contain an understandable example. |
I can't explain it any better than stated in the issue and my previous comment. |
d676912
to
f04e167
Compare
I've updated the PR. I believe the current behavior is as intended and it's just the description that needs a slight modification. The method could also possibly have a better name but I dare not modify it... |
lib/_http_client.js
Outdated
@@ -705,7 +705,7 @@ function onSocketNT(req, socket) { | |||
ClientRequest.prototype._deferToConnect = _deferToConnect; | |||
function _deferToConnect(method, arguments_, cb) { | |||
// This function is for calls that need to happen once the socket is | |||
// connected and writable. It's an important promisy thing for all the socket | |||
// assigned and writable. It's an important promisy thing for all the socket |
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.
You might want to expand this a bit more. What does it mean for the socket to be assigned?
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.
this.socket != null
?
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.
Yes, but why? Sockets are assigned to a request when they are available in the agent.
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.
expanded to follow the description from https://nodejs.org/api/http.html#http_event_socket
f04e167
to
2fd58d5
Compare
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.
LGTM, good work!
Landed in c6f545a |
PR-URL: nodejs#27876 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
PR-URL: #27876 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes #27875. Fix description to actual intended and current behaviour.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes