-
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
setTimeout method of net.Socket should return this #32722
Conversation
need a test update for this? diff --git a/test/parallel/test-net-socket-timeout.js b/test/parallel/test-net-socket-timeout.js
index 8b197b44d6..e01304afe5 100644
--- a/test/parallel/test-net-socket-timeout.js
+++ b/test/parallel/test-net-socket-timeout.js
@@ -70,8 +70,12 @@ for (let i = 0; i < invalidCallbacks.length; i++) {
const server = net.Server();
server.listen(0, common.mustCall(() => {
const socket = net.createConnection(server.address().port);
- socket.setTimeout(1, common.mustCall(() => {
- socket.destroy();
- server.close();
- }));
+ assert.strictEqual(
+ socket.setTimeout(1, common.mustCall(() => {
+ socket.destroy();
+ assert.strictEqual(socket.setTimeout(1, common.mustNotCall()), socket);
+ server.close();
+ })),
+ socket
+ );
})); |
@himself65 Thank you! |
What's this? Should I do something? |
no, we will land this after ci all green(ci sometimes will crash, I don’t know why) |
Function setTimeout in net.Socket should return this, not undefined, as doc said. PR-URL: nodejs#32722 Refs: https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Landed in 4439009 Thanks for your contributions!🎉 |
BTW, I reword the commit message for following the commit rules |
Function setTimeout in net.Socket should return this, not undefined, as doc said. PR-URL: #32722 Refs: https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Function setTimeout in net.Socket should return this, not undefined, as doc said. PR-URL: #32722 Refs: https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Function setTimeout in net.Socket should return this, not undefined, as doc said. PR-URL: #32722 Refs: https://nodejs.org/api/net.html#net_socket_settimeout_timeout_callback Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
setTimeout method of net.Socket should return this, not undefined, as doc said.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes