Skip to content

Commit

Permalink
fix(p2p): additional myself check
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Apr 3, 2019
1 parent 531b9af commit ae760ec
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/background/p2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ class p2p {
return;
}

if(data.peerId === this.peerId) {
logT('p2p', 'try connection to myself, ignore', this.peerId)
return;
}

for(const peer of this.clients) {
if(peer.peerId === data.peerId) {
// already connected from different interface
Expand Down Expand Up @@ -544,6 +549,13 @@ class p2p {
return;
}

// ignore myself check
if(data.peerId === this.peerId) {
logT('p2p', 'try connection to myself, ignore', this.peerId)
rawSocket.destroy()
return;
}

for(let peer of this.peers) {
if(peer.peerId === data.peerId) {
// already connected from different interface
Expand Down

0 comments on commit ae760ec

Please sign in to comment.