diff options
author | Santiago Gimeno <santiago.gimeno@gmail.com> | 2016-05-31 11:16:02 +0200 |
---|---|---|
committer | Santiago Gimeno <santiago.gimeno@gmail.com> | 2016-06-08 15:51:26 +0200 |
commit | 8c53d2fe9f102944cc1889c4efcac7a86224cf0a (patch) | |
tree | 7d853a6a2274058962dbada0b87bf266d725697d /lib/cluster.js | |
parent | 556dd3b7328afebc2591d49ef5dd54e39c05f23b (diff) | |
download | android-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.js | 3 |
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; |