fix(p2p): additional myself check

This commit is contained in:
Alexey Kasyanchuk 2019-04-03 00:27:37 +01:00
parent 80ad766d33
commit 829a12be35

View File

@ -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
@ -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