Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3594e7

Browse filesBrowse files
Imran Iqbalrvagg
authored andcommitted
test: fix test-net-persistent-keepalive for AIX
Fixed an intermittent issue on AIX where the 600ms timeout was reached before the 'connection' event was fired. This resulted in a failure as serverConnection would be undefined and the assert.equal would throw an error. Changed the flow of the test so that the timeout is only set after a connection has been made. PR-URL: #3646 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 325c4c7 commit f3594e7
Copy full SHA for f3594e7

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-net-persistent-keepalive.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-net-persistent-keepalive.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ var assert = require('assert');
44
var net = require('net');
55

66
var serverConnection;
7+
var clientConnection;
78
var echoServer = net.createServer(function(connection) {
89
serverConnection = connection;
10+
setTimeout(function() {
11+
// make sure both connections are still open
12+
assert.equal(serverConnection.readyState, 'open');
13+
assert.equal(clientConnection.readyState, 'open');
14+
serverConnection.end();
15+
clientConnection.end();
16+
echoServer.close();
17+
}, 600);
918
connection.setTimeout(0);
1019
assert.equal(typeof connection.setKeepAlive, 'function');
1120
connection.on('end', function() {
@@ -15,20 +24,11 @@ var echoServer = net.createServer(function(connection) {
1524
echoServer.listen(common.PORT);
1625

1726
echoServer.on('listening', function() {
18-
var clientConnection = new net.Socket();
27+
clientConnection = new net.Socket();
1928
// send a keepalive packet after 1000 ms
2029
// and make sure it persists
2130
var s = clientConnection.setKeepAlive(true, 400);
2231
assert.ok(s instanceof net.Socket);
2332
clientConnection.connect(common.PORT);
2433
clientConnection.setTimeout(0);
25-
26-
setTimeout(function() {
27-
// make sure both connections are still open
28-
assert.equal(serverConnection.readyState, 'open');
29-
assert.equal(clientConnection.readyState, 'open');
30-
serverConnection.end();
31-
clientConnection.end();
32-
echoServer.close();
33-
}, 600);
3434
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.