From 726afd750c23be5ed69a02fff62c2c2f1fe7354f Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Wed, 6 Mar 2019 00:23:37 +0100 Subject: [PATCH] fix(p2p): additional check of dublicated peers --- src/background/p2p.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/background/p2p.js b/src/background/p2p.js index 05453c9..67665a9 100644 --- a/src/background/p2p.js +++ b/src/background/p2p.js @@ -384,6 +384,15 @@ class p2p { return; } + for(let peer of this.peers) { + if(peer.peerId === data.peerId) { + // already connected from different interface + logT('p2p', 'peer', data.peerId, 'already connected from different address', '( check:', peer.files === data.files && peer.torrents === data.torrents, ')'); + rawSocket.destroy() + return; + } + } + // success clearTimeout(protocolTimeout)