pool: lower timeouts

This commit is contained in:
Fedor Indutny 2014-05-06 17:15:23 +04:00
parent 69f3e85e37
commit 762b53a011
4 changed files with 9 additions and 5 deletions

View File

@ -166,6 +166,8 @@ Peer.prototype.destroy = function destroy() {
// Private APIs
Peer.prototype._write = function write(chunk) {
if (!this.socket)
return;
if (NodeBuffer)
this.socket.write(new NodeBuffer(chunk));
else

View File

@ -17,15 +17,15 @@ function Pool(options) {
this.parallel = options.parallel || 2000;
this.redundancy = 2;
this.load = {
timeout: options.loadTimeout || 10000,
timeout: options.loadTimeout || 5000,
window: options.loadWindow || 250,
timer: null,
lwm: options.lwm || this.parallel * 2,
hwm: options.hwm || this.parallel * 8,
hiReached: false
};
this.maxRetries = options.maxRetries || 300;
this.requestTimeout = options.requestTimeout || 10000;
this.maxRetries = options.maxRetries || 10;
this.requestTimeout = options.requestTimeout || 5000;
this.chain = new bcoin.chain();
this.watchMap = {};
this.bloom = new bcoin.bloom(8 * 1024,

View File

@ -15,7 +15,7 @@ TXPool.prototype.add = function add(tx) {
// Do not add TX two times
if (this._all[hash])
return;
return false;
this._all[hash] = tx;
// Consume unspent money or add orphans
@ -54,6 +54,8 @@ TXPool.prototype.add = function add(tx) {
// Add input to orphan
orphan.tx.input(tx, orphan.index);
}
return true;
};
TXPool.prototype.unspent = function unspent(wallet) {

View File

@ -149,7 +149,7 @@ Wallet.prototype.sign = function sign(tx, type) {
};
Wallet.prototype.addTX = function addTX(tx) {
this.tx.add(tx);
return this.tx.add(tx);
};
Wallet.prototype.unspent = function unspent() {