Skip to content

Commit bf94572

Browse files
Trottaddaleax
authored andcommitted
test: fix flaky test-net-can-reset-timeout
Use `.once()` rather than `.on()` for timeout listener. Add comment with URL for issue explaining the purpose of the test. (h/t refack) PR-URL: #14257 Fixes: #14241 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
1 parent 9efd328 commit bf94572

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/parallel/test-net-can-reset-timeout.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@
2121

2222
'use strict';
2323
const common = require('../common');
24+
25+
// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481
26+
2427
const net = require('net');
2528

2629
const server = net.createServer(common.mustCall(function(stream) {
2730
stream.setTimeout(100);
2831

2932
stream.resume();
3033

31-
stream.on('timeout', common.mustCall(function() {
34+
stream.once('timeout', common.mustCall(function() {
3235
console.log('timeout');
3336
// try to reset the timeout.
3437
stream.write('WHAT.');

0 commit comments

Comments
 (0)