summaryrefslogtreecommitdiff
path: root/lib/cluster.js
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2016-05-31 11:16:02 +0200
committerSantiago Gimeno <santiago.gimeno@gmail.com>2016-06-08 15:51:26 +0200
commit8c53d2fe9f102944cc1889c4efcac7a86224cf0a (patch)
tree7d853a6a2274058962dbada0b87bf266d725697d /lib/cluster.js
parent556dd3b7328afebc2591d49ef5dd54e39c05f23b (diff)
downloadandroid-node-v8-8c53d2fe9f102944cc1889c4efcac7a86224cf0a.tar.gz
android-node-v8-8c53d2fe9f102944cc1889c4efcac7a86224cf0a.tar.bz2
android-node-v8-8c53d2fe9f102944cc1889c4efcac7a86224cf0a.zip
cluster: don't send messages if no IPC channel
Avoid sending messages if the IPC channel is already disconnected. It avoids undesired errors when calling `process.disconnect` when there are still pending IPC messages. PR-URL: https://github.com/nodejs/node/pull/7132 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/cluster.js')
-rw-r--r--lib/cluster.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/cluster.js b/lib/cluster.js
index 228ad0dfe2..b4e2ea42dd 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -743,6 +743,9 @@ function workerInit() {
var seq = 0;
var callbacks = {};
function sendHelper(proc, message, handle, cb) {
+ if (!proc.connected)
+ return false;
+
// Mark message as internal. See INTERNAL_PREFIX in lib/child_process.js
message = util._extend({ cmd: 'NODE_CLUSTER' }, message);
if (cb) callbacks[seq] = cb;