aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-shared-leak.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-cluster-shared-leak.js')
-rw-r--r--test/parallel/test-cluster-shared-leak.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/parallel/test-cluster-shared-leak.js b/test/parallel/test-cluster-shared-leak.js
index a4de1d33a2..55df57c983 100644
--- a/test/parallel/test-cluster-shared-leak.js
+++ b/test/parallel/test-cluster-shared-leak.js
@@ -15,14 +15,16 @@ if (cluster.isMaster) {
worker1 = cluster.fork();
worker1.on('message', common.mustCall(function() {
worker2 = cluster.fork();
- conn = net.connect(common.PORT, common.mustCall(function() {
- worker1.send('die');
- worker2.send('die');
- }));
- conn.on('error', function(e) {
- // ECONNRESET is OK
- if (e.code !== 'ECONNRESET')
- throw e;
+ worker2.on('online', function() {
+ conn = net.connect(common.PORT, common.mustCall(function() {
+ worker1.send('die');
+ worker2.send('die');
+ }));
+ conn.on('error', function(e) {
+ // ECONNRESET is OK
+ if (e.code !== 'ECONNRESET')
+ throw e;
+ });
});
}));