mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
cluster: expose result of send()
There are several places in the cluster module where a version of process.send() is called, but the result is swallowed. Most of these cases are internal, but Worker.prototype.send(), which is publicly documented, also suffers from this problem. This commit exposes the return value to facilitate better error handling, and bring Worker.prototype.send() into compliance with the documentation. PR-URL: https://github.com/nodejs/node/pull/6998 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ron Korving <ron@ronkorving.nl> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
c4f80c1f34
commit
67368d8553
3 changed files with 8 additions and 6 deletions
|
@ -61,7 +61,7 @@ Worker.prototype.kill = function() {
|
|||
};
|
||||
|
||||
Worker.prototype.send = function() {
|
||||
this.process.send.apply(this.process, arguments);
|
||||
return this.process.send.apply(this.process, arguments);
|
||||
};
|
||||
|
||||
Worker.prototype.isDead = function isDead() {
|
||||
|
@ -533,7 +533,7 @@ function masterInit() {
|
|||
}
|
||||
|
||||
function send(worker, message, handle, cb) {
|
||||
sendHelper(worker.process, message, handle, cb);
|
||||
return sendHelper(worker.process, message, handle, cb);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ function workerInit() {
|
|||
};
|
||||
|
||||
function send(message, cb) {
|
||||
sendHelper(process, message, null, cb);
|
||||
return sendHelper(process, message, null, cb);
|
||||
}
|
||||
|
||||
function _disconnect(masterInitiated) {
|
||||
|
@ -747,7 +747,7 @@ function sendHelper(proc, message, handle, cb) {
|
|||
if (cb) callbacks[seq] = cb;
|
||||
message.seq = seq;
|
||||
seq += 1;
|
||||
proc.send(message, handle);
|
||||
return proc.send(message, handle);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue