ignore misbehaving leeches.
This commit is contained in:
parent
c5fc69ee93
commit
1de2df0c3a
@ -429,10 +429,22 @@ Pool.prototype.listen = function listen(callback) {
|
||||
}
|
||||
|
||||
this.server.on('connection', function(socket) {
|
||||
var hostname;
|
||||
|
||||
if (self.peers.leeches.length >= self.maxLeeches) {
|
||||
hostname = utils.hostname(socket.remoteAddress, socket.remotePort);
|
||||
bcoin.debug('Ignoring leech: too many leeches (%s).', hostname);
|
||||
socket.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.isMisbehaving(socket.remoteAddress)) {
|
||||
hostname = utils.hostname(socket.remoteAddress, socket.remotePort);
|
||||
bcoin.debug('Ignoring misbehaving leech (%s).', hostname);
|
||||
socket.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
self._addLeech(socket);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user