From fb5a1de8a2a301c4637f57c3c46b8c8486f143dc Mon Sep 17 00:00:00 2001 From: cubedro Date: Wed, 18 Feb 2015 04:59:03 +0200 Subject: [PATCH] added force send after 5 updates --- lib/node.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/node.js b/lib/node.js index 934c5a0..2dad557 100644 --- a/lib/node.js +++ b/lib/node.js @@ -60,6 +60,7 @@ function Node() this._tries = 0; this._down = 0; + this._lastSent = 0; this.blocks = []; @@ -286,6 +287,15 @@ Node.prototype.changed = function() { var changed = ! _.isEqual(this._lastStats, JSON.stringify(this.stats)); console.log(changed); + + if(this._tries - this._lastSent > 5) + { + console.log('force send'); + this._lastSent = this._tries; + + return true; + } + return changed; }