fixed socket ready event

This commit is contained in:
cubedro 2015-02-18 04:32:03 +02:00
parent a019d77205
commit c3b41ccbda
1 changed files with 18 additions and 16 deletions

View File

@ -85,11 +85,8 @@ function Node()
socket.on('ready', function()
{
if(self.changed())
{
self._socket = true;
self.sendUpdate(true);
}
self._socket = true;
self.sendUpdate(true);
console.log('The connection has been established.');
})
@ -105,25 +102,30 @@ Node.prototype.isActive = function()
this.stats.errors = [];
try {
this.stats.peers = web3.eth.peerCount;
this.stats.active = true;
var peers = web3.eth.peerCount;
return true;
if(peers !== null)
{
this.stats.peers = peers;
this.stats.active = true;
return true;
}
}
catch (err) {
this.stats.active = false;
this.stats.listening = false;
this.stats.mining = false;
this.stats.peers = 0;
this._down++;
this.stats.errors.push({
code: '1',
msg: err
});
return false;
}
this.stats.active = false;
this.stats.listening = false;
this.stats.mining = false;
this.stats.peers = 0;
this._down++;
return false;
}
Node.prototype.getBlock = function(number)