Added 'listenAddr' to p2p options.
This commit is contained in:
parent
678b694a58
commit
4ebb7ac569
@ -167,15 +167,21 @@ P2P.prototype._broadcast = function(subscribers, name, entity) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype._connect = function() {
|
P2P.prototype._connect = function() {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
log.info('Connecting to p2p network.');
|
log.info('Connecting to p2p network.');
|
||||||
self._pool.connect();
|
self._pool.connect();
|
||||||
|
|
||||||
var retryInterval = setInterval(function() {
|
var retryInterval = setInterval(function() {
|
||||||
|
log.info('Retrying connection to p2p network.');
|
||||||
self._pool.connect();
|
self._pool.connect();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
self._pool.once('peerready', function() {
|
self._pool.once('peerready', function() {
|
||||||
clearInterval(retryInterval);
|
clearInterval(retryInterval);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype._getBestHeight = function() {
|
P2P.prototype._getBestHeight = function() {
|
||||||
@ -230,6 +236,7 @@ P2P.prototype._initPool = function() {
|
|||||||
opts.addrs = this._configPeers;
|
opts.addrs = this._configPeers;
|
||||||
}
|
}
|
||||||
opts.dnsSeed = false;
|
opts.dnsSeed = false;
|
||||||
|
opts.listenAddr = false;
|
||||||
opts.maxPeers = this._maxPeers;
|
opts.maxPeers = this._maxPeers;
|
||||||
opts.network = this.node.network;
|
opts.network = this.node.network;
|
||||||
this._pool = new p2p.Pool(opts);
|
this._pool = new p2p.Pool(opts);
|
||||||
@ -249,12 +256,14 @@ P2P.prototype._onPeerBlock = function(peer, message) {
|
|||||||
P2P.prototype._onPeerDisconnect = function(peer, addr) {
|
P2P.prototype._onPeerDisconnect = function(peer, addr) {
|
||||||
|
|
||||||
if (!this.node.stopping) {
|
if (!this.node.stopping) {
|
||||||
|
log.info('Attempting to reconnect to the p2p network after disconnect signal.');
|
||||||
this._connect();
|
this._connect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._removePeer(peer);
|
this._removePeer(peer);
|
||||||
log.info('Disconnected from peer: ' + addr.ip.v4);
|
log.info('Disconnected from peer: ' + addr.ip.v4);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
P2P.prototype._onPeerHeaders = function(peer, message) {
|
P2P.prototype._onPeerHeaders = function(peer, message) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user