Skip to content
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

Test net keepalive #9995

Closed
wants to merge 2 commits into from
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
14 changes: 7 additions & 7 deletions test/parallel/test-net-keepalive.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var net = require('net');
const common = require('../common');
const assert = require('assert');
const net = require('net');

var serverConnection;
var clientConnection;
var echoServer = net.createServer(function(connection) {
serverConnection = connection;
setTimeout(function() {
setTimeout(common.mustCall(function() {
// make sure both connections are still open
assert.equal(serverConnection.readyState, 'open');
assert.equal(clientConnection.readyState, 'open');
assert.strictEqual(serverConnection.readyState, 'open');
assert.strictEqual(clientConnection.readyState, 'open');
serverConnection.end();
clientConnection.end();
echoServer.close();
}, common.platformTimeout(100));
}, 1), common.platformTimeout(100));
Copy link
Member

Choose a reason for hiding this comment

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

Just fyi... when using common.mustCall(), the default for the second argument (which specifies the number of times the function is expected to be called, is already 1 so there is no reason to set it explicitly here. It's a minor nit tho and I wouldn't worry about changing it.

connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms
Expand Down