Skip to content

Commit 1e40390

Browse files
TrottMylesBorins
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 95be08e commit 1e40390

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
@@ -1,13 +1,16 @@
11
'use strict';
22
const common = require('../common');
3+
4+
// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481
5+
36
const net = require('net');
47

58
const server = net.createServer(common.mustCall(function(stream) {
69
stream.setTimeout(100);
710

811
stream.resume();
912

10-
stream.on('timeout', common.mustCall(function() {
13+
stream.once('timeout', common.mustCall(function() {
1114
console.log('timeout');
1215
// try to reset the timeout.
1316
stream.write('WHAT.');

0 commit comments

Comments
 (0)