diff --git a/examples/PeerDiscovery.js b/examples/PeerDiscovery.js index dfbec6561..b070c2977 100644 --- a/examples/PeerDiscovery.js +++ b/examples/PeerDiscovery.js @@ -1,4 +1,4 @@ var PeerManager = require('../lib/PeerManager'); var peerman = new PeerManager(); -peerman.discover({ limit: 6 }).start(); +peerman.discover({ limit: 12 }).start(); diff --git a/lib/PeerManager.js b/lib/PeerManager.js index 85cbb229e..c9f692446 100644 --- a/lib/PeerManager.js +++ b/lib/PeerManager.js @@ -90,6 +90,13 @@ PeerManager.prototype.checkStatus = function checkStatus() { } }); + // for debug purposes, print how many of our peers are actually connected + var connected = 0 + this.peers.forEach(function(p) { + if (p.connection && !p.connection._connecting) connected++ + }); + log.info(connected + ' of ' + this.peers.length + ' peers connected'); + Object.keys(peerIndex).forEach(function(i) { this.connectTo(peerIndex[i]); }.bind(this)); @@ -192,8 +199,8 @@ PeerManager.prototype.handleDisconnect = function(e) { if(i != -1) this.connections.splice(i, 1); this.removePeer(e.peer); - log.info('replacing peer with one from the pool of: ' + this.pool.length); if (this.pool.length) { + log.info('replacing peer using the pool of ' + this.pool.length + ' seeds'); this.addPeer(this.pool.pop()); }