Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: fix flaky test-net-can-reset-timeout
Fixes: #14241
  • Loading branch information
Trott committed Jul 16, 2017
commit f9d1804857637d836d43647c09e9717dfdc7922a
5 changes: 4 additions & 1 deletion test/parallel/test-net-can-reset-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@

'use strict';
const common = require('../common');

// Ref: https://github.com/nodejs/node-v0.x-archive/issues/481

const net = require('net');

const server = net.createServer(common.mustCall(function(stream) {
stream.setTimeout(100);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with once?


stream.resume();

stream.on('timeout', common.mustCall(function() {
stream.once('timeout', common.mustCall(function() {
console.log('timeout');
// try to reset the timeout.
stream.write('WHAT.');
Expand Down