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 // Private APIs
Peer.prototype._write = function write(chunk) { Peer.prototype._write = function write(chunk) {
if (!this.socket)
return;
if (NodeBuffer) if (NodeBuffer)
this.socket.write(new NodeBuffer(chunk)); this.socket.write(new NodeBuffer(chunk));
else else

View File

@ -17,15 +17,15 @@ function Pool(options) {
this.parallel = options.parallel || 2000; this.parallel = options.parallel || 2000;
this.redundancy = 2; this.redundancy = 2;
this.load = { this.load = {
timeout: options.loadTimeout || 10000, timeout: options.loadTimeout || 5000,
window: options.loadWindow || 250, window: options.loadWindow || 250,
timer: null, timer: null,
lwm: options.lwm || this.parallel * 2, lwm: options.lwm || this.parallel * 2,
hwm: options.hwm || this.parallel * 8, hwm: options.hwm || this.parallel * 8,
hiReached: false hiReached: false
}; };
this.maxRetries = options.maxRetries || 300; this.maxRetries = options.maxRetries || 10;
this.requestTimeout = options.requestTimeout || 10000; this.requestTimeout = options.requestTimeout || 5000;
this.chain = new bcoin.chain(); this.chain = new bcoin.chain();
this.watchMap = {}; this.watchMap = {};
this.bloom = new bcoin.bloom(8 * 1024, 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 // Do not add TX two times
if (this._all[hash]) if (this._all[hash])
return; return false;
this._all[hash] = tx; this._all[hash] = tx;
// Consume unspent money or add orphans // Consume unspent money or add orphans
@ -54,6 +54,8 @@ TXPool.prototype.add = function add(tx) {
// Add input to orphan // Add input to orphan
orphan.tx.input(tx, orphan.index); orphan.tx.input(tx, orphan.index);
} }
return true;
}; };
TXPool.prototype.unspent = function unspent(wallet) { 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) { Wallet.prototype.addTX = function addTX(tx) {
this.tx.add(tx); return this.tx.add(tx);
}; };
Wallet.prototype.unspent = function unspent() { Wallet.prototype.unspent = function unspent() {