diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index bce36b53bbe5d2..b30ec2a7dc019f 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -21,4 +21,3 @@ test-child-process-exit-code : PASS,FLAKY [$system==solaris] # Also applies to SmartOS [$system==freebsd] -test-net-socket-local-address : PASS,FLAKY diff --git a/test/parallel/test-net-socket-local-address.js b/test/parallel/test-net-socket-local-address.js index 502c2d226d54b8..b174914151f4fd 100644 --- a/test/parallel/test-net-socket-local-address.js +++ b/test/parallel/test-net-socket-local-address.js @@ -12,10 +12,15 @@ if (common.inFreeBSDJail) { var conns = 0; var clientLocalPorts = []; var serverRemotePorts = []; +var serverNeedsToFireConnection = false; const server = net.createServer(function(socket) { serverRemotePorts.push(socket.remotePort); conns++; + if (serverNeedsToFireConnection) { + serverNeedsToFireConnection = false; + testConnect(); + } }); const client = new net.Socket(); @@ -34,7 +39,13 @@ function testConnect() { } client.connect(common.PORT, common.localhostIPv4, function() { clientLocalPorts.push(this.localPort); - this.once('close', testConnect); + this.once('close', function() { + if (conns === clientLocalPorts.length) { + testConnect(); + } else { + serverNeedsToFireConnection = true; + } + }); this.destroy(); }); }