From 0d3a80639ac0d2f4a0b180db1456640b938c8253 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 15 Jan 2014 15:05:11 -0300 Subject: [PATCH 1/2] add option to RpcClient to enable keep-alive (false by default) --- RpcClient.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RpcClient.js b/RpcClient.js index 959ea31..3304fe6 100644 --- a/RpcClient.js +++ b/RpcClient.js @@ -16,6 +16,7 @@ function ClassSpec(b) { this.pass = opts.pass || 'pass'; this.protocol = (opts.protocol == 'http') ? http : https; this.batchedCalls = null; + this.keepConnectionAlive = opts.keepConnectionAlive || false; } RpcClient.prototype.batch = function(batchCallback, resultCallback) { @@ -146,6 +147,7 @@ function ClassSpec(b) { path: '/', method: 'POST', port: self.port, + agent: self.keepConnectionAlive ? undefined : false, }; if(self.httpOptions) { for(var k in self.httpOptions) { From 7c787edf85344569622af7188ed35f5babf77f79 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 15 Jan 2014 21:51:51 -0300 Subject: [PATCH 2/2] change RPC agent default --- RpcClient.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RpcClient.js b/RpcClient.js index 3304fe6..8859733 100644 --- a/RpcClient.js +++ b/RpcClient.js @@ -16,7 +16,7 @@ function ClassSpec(b) { this.pass = opts.pass || 'pass'; this.protocol = (opts.protocol == 'http') ? http : https; this.batchedCalls = null; - this.keepConnectionAlive = opts.keepConnectionAlive || false; + this.disableAgent = opts.disableAgent || false; } RpcClient.prototype.batch = function(batchCallback, resultCallback) { @@ -147,7 +147,7 @@ function ClassSpec(b) { path: '/', method: 'POST', port: self.port, - agent: self.keepConnectionAlive ? undefined : false, + agent: self.disableAgent ? false : undefined, }; if(self.httpOptions) { for(var k in self.httpOptions) {