diff --git a/lib/bcoin/pool.js b/lib/bcoin/pool.js index 63bc1865..4340a135 100644 --- a/lib/bcoin/pool.js +++ b/lib/bcoin/pool.js @@ -430,6 +430,12 @@ Pool.prototype.listen = function listen(callback) { this.server.on('connection', function(socket) { var hostname; + if (!socket.remoteAddress) { + bcoin.debug('Ignoring disconnected leech.'); + socket.destroy(); + return; + } + if (self.peers.leeches.length >= self.maxLeeches) { hostname = utils.hostname(socket.remoteAddress, socket.remotePort); bcoin.debug('Ignoring leech: too many leeches (%s).', hostname);