Comparing version 2.1.0 to 2.1.1
# node-bitcoin changelog | ||
## v2.1.1 (2014/03/25) | ||
* change default request timeout from `5000`ms to `30000`ms | ||
## v2.1.0 (2014/03/12) | ||
@@ -4,0 +7,0 @@ * remove `deprecate` dependency |
@@ -12,3 +12,3 @@ var http = require('http'), | ||
var requestJSON; | ||
if (Array.isArray(method)) { | ||
@@ -49,7 +49,7 @@ // multiple rpc batch call | ||
}; | ||
if (this.opts.ssl && this.opts.sslCa) { | ||
requestOptions.ca = this.opts.sslCa; | ||
} | ||
// use HTTP auth if user and password set | ||
@@ -59,7 +59,7 @@ if (this.opts.user && this.opts.pass) { | ||
} | ||
// Now we'll make a request to the server | ||
var cbCalled = false; | ||
var request = this.http.request(requestOptions); | ||
// start request timeout timer | ||
@@ -73,6 +73,6 @@ var reqTimeout = setTimeout(function() { | ||
errback(err); | ||
}, this.opts.timeout || 5000); | ||
}, this.opts.timeout || 30000); | ||
// set additional timeout on socket in case of remote freeze after sending headers | ||
request.setTimeout(this.opts.timeout || 5000, function() { | ||
request.setTimeout(this.opts.timeout || 30000, function() { | ||
if (cbCalled) return; | ||
@@ -85,3 +85,3 @@ cbCalled = true; | ||
}); | ||
request.on('error', function(err) { | ||
@@ -96,3 +96,3 @@ if (cbCalled) return; | ||
clearTimeout(reqTimeout); | ||
// We need to buffer the response chunks in a nonblocking way. | ||
@@ -108,6 +108,6 @@ var buffer = ''; | ||
var err; | ||
if (cbCalled) return; | ||
cbCalled = true; | ||
try { | ||
@@ -127,7 +127,7 @@ var decoded = JSON.parse(buffer); | ||
} | ||
if (!Array.isArray(decoded)) { | ||
decoded = [decoded]; | ||
} | ||
// iterate over each response, normally there will be just one | ||
@@ -158,3 +158,3 @@ // unless a batch rpc call response is being processed | ||
}); | ||
}); | ||
@@ -161,0 +161,0 @@ }); |
{ | ||
"name": "bitcoin", | ||
"description": "Communicate with bitcoind via JSON-RPC", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -25,3 +25,3 @@ # node-bitcoin | ||
pass: 'password', | ||
timeout: 5000 | ||
timeout: 30000 | ||
}); | ||
@@ -71,3 +71,3 @@ ``` | ||
When enabling `ssl` by setting the configuration option to `true`, the `sslStrict` | ||
option (verifies the server certificate) will also be enabled by default. It is | ||
option (verifies the server certificate) will also be enabled by default. It is | ||
highly recommended to specify the `sslCa` as well, even if your bitcoind has | ||
@@ -74,0 +74,0 @@ a certificate signed by an actual CA, to ensure you are connecting |
14499