peer: timeout inv spamming.
This commit is contained in:
parent
829e62b079
commit
4c4cf9e6a4
@ -199,6 +199,14 @@ Peer.RESPONSE_TIMEOUT = 30000;
|
||||
|
||||
Peer.BLOCK_TIMEOUT = 60000;
|
||||
|
||||
/**
|
||||
* Max number of requested items.
|
||||
* @const {Number}
|
||||
* @default
|
||||
*/
|
||||
|
||||
Peer.MAX_REQUESTS = 5000;
|
||||
|
||||
/**
|
||||
* Create inbound peer from socket.
|
||||
* @param {PeerOptions} options
|
||||
@ -1307,6 +1315,14 @@ Peer.prototype.maybeTimeout = function maybeTimeout() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.options.isFull()) {
|
||||
if (this.requestMap.size > Peer.MAX_REQUESTS) {
|
||||
this.error('Peer is stalling (data).');
|
||||
this.destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user