fixed socket ready event
This commit is contained in:
parent
a019d77205
commit
c3b41ccbda
34
lib/node.js
34
lib/node.js
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user