peer: some comments. do not kill on late pong.

This commit is contained in:
Christopher Jeffrey 2017-01-08 22:29:57 -08:00
parent 469da05515
commit c7ce8c778b
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -159,21 +159,94 @@ function Peer(pool) {
util.inherits(Peer, EventEmitter);
/**
* Max output bytes buffered before
* invoking stall behavior for peer.
* @const {Number}
* @default
*/
Peer.DRAIN_MAX = 5 << 20;
/**
* Timeout for peer to read from
* their end of the socket.
* @const {Number}
* @default
*/
Peer.DRAIN_TIMEOUT = 10000;
/**
* Interval to check for drainage
* and required responses from peer.
* @const {Number}
* @default
*/
Peer.STALL_INTERVAL = 5000;
/**
* Interval for pinging peers.
* @const {Number}
* @default
*/
Peer.PING_INTERVAL = 30000;
/**
* Interval to flush invs.
* Higher means more invs (usually
* txs) will be accumulated before
* flushing.
* @const {Number}
* @default
*/
Peer.INV_INTERVAL = 5000;
/**
* Required time for peers to
* respond to messages (i.e.
* getblocks/getdata).
* @const {Number}
* @default
*/
Peer.RESPONSE_TIMEOUT = 30000;
/**
* Getter to retrieve host.
* @function
* @name host(get)
* @memberof Peer#
* @returns {String}
*/
Peer.prototype.__defineGetter__('host', function() {
return this.address.host;
});
/**
* Getter to retrieve port.
* @function
* @name port(get)
* @memberof Peer#
* @returns {Number}
*/
Peer.prototype.__defineGetter__('port', function() {
return this.address.port;
});
/**
* Getter to retrieve hostname.
* @function
* @name hostname(get)
* @memberof Peer#
* @returns {Number}
*/
Peer.prototype.__defineGetter__('hostname', function() {
return this.address.hostname;
});
@ -862,7 +935,6 @@ Peer.prototype.sendPing = function sendPing() {
if (this.challenge) {
this.logger.debug('Peer has not responded to ping (%s).', this.hostname);
this.destroy();
return;
}