From 902fa59ca995cb40ab1a09e709a991931979f1ce Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 25 Aug 2016 20:42:28 -0700 Subject: [PATCH] pool: handle host+port collision between inbound and outbound. --- lib/net/pool.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/net/pool.js b/lib/net/pool.js index eacb26fe..ce7fbd00 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -510,6 +510,14 @@ Pool.prototype._handleLeech = function _handleLeech(socket) { return; } + // Some kind of weird port collision + // between inbound ports and outbound ports. + if (this.peers.get(addr)) { + this.logger.debug('Port collision (%s).', hostname); + socket.destroy(); + return; + } + this.addLeech(socket); };