| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
needs test coverage
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung Are you ok with this comment being added?
Sorry, something went wrong.
There was a problem hiding this comment.
this code is same code as original line number 62 to 68.
and while doing this, i also considered exports.createConnection this function to just create new Socket and call connect by just forwarding arguments (for higher code coverage, if it is okay to move options.timeout also within Socket.prototype.connect.
e.g.
...
exports.connect = exports.createConnection = function(options) {
const socket = new Socket(options);
return Socket.prototype.connect.apply(socket, arguments);
};
...
Socket.prototype.connect = function() {
const args = new Array(arguments.length);
for (var i = 0; i < arguments.length; i++)
args[i] = arguments[i];
// TODO(joyeecheung): use destructuring when V8 is fast enough
const normalized = normalizeArgs(args);
const options = normalized[0];
const cb = normalized[1];
debug('Socket.connect', normalized);
if (options.timeout)
this.setTimeout(options.timeout);
if (this.write !== Socket.prototype.write)
this.write = Socket.prototype.write;
...what do you think @joyeecheung @mscdex
Sorry, something went wrong.
There was a problem hiding this comment.
never mind. i think this code cannot be merged easily since new Socket requires normalized options.
Sorry, something went wrong.
There was a problem hiding this comment.
I'll be OK with that if it's just copy-pasting.
The timeouts are added in #8101, I can't see any harm adding them to Socket.prototype.connect, so +1 to reduce code duplicate.
Sorry, something went wrong.
There was a problem hiding this comment.
Yup. but anyway we need to normalizeArgs on exports.createConnection since arguments of new Socket needs normalized arguments.
I will just add one more commit to move timeout from exports.createConnection to Socket.prototype.connect.
After that, maybe it should be good to merge?
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
@vhain (hit the button too soon)..but yeah you can push it here(should be semver-patch) or add it in a separate PR(semver-minor).
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung oops.. was too fast. already added commit to this PR. do you want me to revert that commit only?
Sorry, something went wrong.
There was a problem hiding this comment.
@vhain I don't think it needs to be reverted if no one objects to / spots a bug caused by moving it down though.
Sorry, something went wrong.
There was a problem hiding this comment.
@joyeecheung right. it needs to be different branch and PR. i'm on it.
it's done ccb807e
Sorry, something went wrong.
There was a problem hiding this comment.
I'll be OK with that if it's just copy-pasting.
The timeouts are added in #8101, I can't see any harm adding them to Socket.prototype.connect, so +1 to reduce code duplicate.
Sorry, something went wrong.
Sorry, something went wrong.
|
New CI after revert: https://ci.nodejs.org/job/node-test-pull-request/6761/ |
Sorry, something went wrong.
|
FWIW, to make this pull request easier to find via google/github search - here is the stack trace we observed in LoopBack tests when calling net.createConnection(port) (see strongloop/loopback#3262) Uncaught TypeError: "listener" argument must be a function
at Socket.connect (net.js:943:10)
at Socket.connect (node_modules/async-listener/index.js:76:27)
at Object.exports.connect.exports.createConnection (net.js:76:35)
at sendHttpRequestInOnePacket (test/integration.test.js:77:24)
at Server.<anonymous> (test/integration.test.js:19:7)
at emitListeningNT (net.js:1302:10)
at node_modules/async-listener/glue.js:188:31
at _combinedTickCallback (internal/process/next_tick.js:77:11)
at process._tickDomainCallback [as _tickCallback] (internal/process/next_tick.js:128:9)
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with a nit.
Sorry, something went wrong.
There was a problem hiding this comment.
The callback here needs to be wrapped in common.mustCall().
Sorry, something went wrong.
There was a problem hiding this comment.
The callback here needs to be wrapped in common.mustCall() as well
Sorry, something went wrong.
There was a problem hiding this comment.
I am on it. but then test/parallel/test-net-socket-connecting.js also need to be changed in future?
anyway for this PR, i will only wrap test-net-socket-connect-without-cb.js callback with common.mustCall
Sorry, something went wrong.
There was a problem hiding this comment.
@evanlucas commit is added. Thanks for the comment.
Sorry, something went wrong.
There was a problem hiding this comment.
other than the missing comment in the test file, LGTM. It also needs to be rebased and squashed.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
|
https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit <--after squashing, commit message should be reworked to follow guidelines (it shouldn't have the PR number in the subject, and doesn't need PR-URL in the description, but it should have a Fixes: https://github.com/nodejs/node/pull/11761 in the description) |
Sorry, something went wrong.
|
@sam-github comment added to test to match guideline, as well as squashing. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
@nodejs/ctc this fixes a breaking bug in recent 7.x, it would be good to get a fix out |
Sorry, something went wrong.
|
@nodejs/release ^^^ |
Sorry, something went wrong.
|
One of us will be able to cut one next week. We try to release on Tuesday or Wednesday generally. |
Sorry, something went wrong.
|
@evanlucas The callbacks are wrapped in common.mustCall now, LGTY? |
Sorry, something went wrong.
Arguments of Socket.prototype.connect should be also normalized, causing error when called without callback. Changed Socket.prototype.connect's code same as net.connect and added test. Fixes: #11761 PR-URL: #11762 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
|
ARM and FreeBSD failures are false positives. Landed in c6cbbf9, again, sorry for the inconvenience and thanks for the fix! |
Sorry, something went wrong.
Arguments of Socket.prototype.connect should be also normalized, causing error when called without callback. Changed Socket.prototype.connect's code same as net.connect and added test. Fixes: nodejs#11761 PR-URL: nodejs#11762 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Notable changes: * module: fix loading from global folders on Windows (Richard Lau) [nodejs#9283](nodejs#9283) * net: allow missing callback for Socket.connect (Juwan Yoo) [nodejs#11762](nodejs#11762) PR-URL: nodejs#11831
Notable changes: * module: The [module loading global fallback] (https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_loading_from_the_global_folders) to the Node executable's directory now works correctly on Windows. (Richard Lau) [nodejs#9283](nodejs#9283) * net: `Socket.prototype.connect` now once again functions without a callback. (Juwan Yoo) [nodejs#11762](nodejs#11762) * url: `URL.prototype.origin` now properly specified an opaque return of `'null'` for `file://` URLs. (Brian White) [nodejs#11691](nodejs#11691) PR-URL: nodejs#11831
Notable changes: * module: The [module loading global fallback] (https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_loading_from_the_global_folders) to the Node executable's directory now works correctly on Windows. (Richard Lau) [nodejs#9283](nodejs#9283) * net: `Socket.prototype.connect` now once again functions without a callback. (Juwan Yoo) [nodejs#11762](nodejs#11762) * url: `URL.prototype.origin` now properly specified an opaque return of `'null'` for `file://` URLs. (Brian White) [nodejs#11691](nodejs#11691) PR-URL: nodejs#11831
Notable changes:
* module: The [module loading global fallback]
(https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_loading_from_the_global_folders)
to the Node executable's directory now works correctly on Windows.
(Richard Lau) [#9283](nodejs/node#9283)
* net: `Socket.prototype.connect` now once again functions without
a callback. (Juwan Yoo) [#11762](nodejs/node#11762)
* url: `URL.prototype.origin` now properly specified an opaque return of
`'null'` for `file://` URLs. (Brian White)
[#11691](nodejs/node#11691)
PR-URL: nodejs/node#11831
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
Arguments of Socket.prototype.connect should be also normalized, causing error when called without callback. Changed Socket.prototype.connect's code same as net.connect and added test. Fixes: nodejs#11761 PR-URL: nodejs#11762 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
Notable changes: * module: The [module loading global fallback] (https://nodejs.org/dist/latest-v6.x/docs/api/modules.html#modules_loading_from_the_global_folders) to the Node executable's directory now works correctly on Windows. (Richard Lau) [nodejs#9283](nodejs#9283) * net: `Socket.prototype.connect` now once again functions without a callback. (Juwan Yoo) [nodejs#11762](nodejs#11762) * url: `URL.prototype.origin` now properly specified an opaque return of `'null'` for `file://` URLs. (Brian White) [nodejs#11691](nodejs#11691) PR-URL: nodejs#11831
|
should this be backported? |
Sorry, something went wrong.
|
Only if we decide to backport #11667, as this is a fix for that. |
Sorry, something went wrong.
|
#11667 depends on a 7.x semver major patch so this one should not be backported either. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Checklist
Affected core subsystem(s)
net.Socket.prototype.connect
#11761