From 1df857ce3addb44fa86484448582756e407fa940 Mon Sep 17 00:00:00 2001 From: Luke Stratman Date: Wed, 24 May 2017 13:36:40 -0400 Subject: [PATCH] Cluster module support Added an option to control whether or not node-ipc unlinks the Unix socket path when it starts a server which, when set to false, allows the overall application to handle this and allows node-ipc to work with the Node.js cluster module. --- dao/socketServer.js | 12 ++++++++---- entities/Defaults.js | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/dao/socketServer.js b/dao/socketServer.js index b192b41..bd60d83 100644 --- a/dao/socketServer.js +++ b/dao/socketServer.js @@ -58,10 +58,14 @@ class Server extends Events{ return; } - fs.unlink( - this.path, - startServer.bind(this) - ); + if(this.config.unlink){} + fs.unlink( + this.path, + startServer.bind(this) + ); + }else{ + startServer.bind(this)(); + } } } diff --git a/entities/Defaults.js b/entities/Defaults.js index 19623d4..081f093 100644 --- a/entities/Defaults.js +++ b/entities/Defaults.js @@ -28,6 +28,7 @@ class Defaults{ this.encoding='utf8'; this.rawBuffer=false; this.sync=false; + this.unlink=true; this.delimiter='\f';