summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-07-30 01:05:11 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2015-07-30 18:17:53 +0200
commitfa98b97171d9b8519bdbf5d9f8dbd8639ac3c050 (patch)
tree266415c8be075aeed4c3f0a4cfa9bc7333bedbef /lib
parent3cbb5870e5c8ce6a9da718c7fff6f50709545ed5 (diff)
downloadandroid-node-v8-fa98b97171d9b8519bdbf5d9f8dbd8639ac3c050.tar.gz
android-node-v8-fa98b97171d9b8519bdbf5d9f8dbd8639ac3c050.tar.bz2
android-node-v8-fa98b97171d9b8519bdbf5d9f8dbd8639ac3c050.zip
cluster: add handle ref/unref stubs in rr mode
Add ref() and unref() stub methods to the faux handle in round-robin mode. Fixes the following TypeError when calling `server.unref()` in the worker: net.js:1521 this._handle.unref(); ^ TypeError: this._handle.unref is not a function at Server.unref (net.js:1521:18) No actual reference counting is implemented. It would effectively be a no-op because the control channel would still keep the worker alive. Fixes: https://github.com/nodejs/node/issues/73 PR-URL: https://github.com/nodejs/io.js/pull/2274 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/cluster.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/cluster.js b/lib/cluster.js
index bcde4ce1fa..9f70c0273c 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -603,12 +603,22 @@ function workerInit() {
return 0;
}
+ // XXX(bnoordhuis) Probably no point in implementing ref() and unref()
+ // because the control channel is going to keep the worker alive anyway.
+ function ref() {
+ }
+
+ function unref() {
+ }
+
// Faux handle. Mimics a TCPWrap with just enough fidelity to get away
// with it. Fools net.Server into thinking that it's backed by a real
// handle.
var handle = {
close: close,
- listen: listen
+ listen: listen,
+ ref: ref,
+ unref: unref,
};
if (message.sockname) {
handle.getsockname = getsockname; // TCP handles only.