fix(p2p): additional myself check
This commit is contained in:
parent
80ad766d33
commit
829a12be35
@ -116,6 +116,11 @@ class p2p {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(data.peerId === this.peerId) {
|
||||||
|
logT('p2p', 'try connection to myself, ignore', this.peerId)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(const peer of this.clients) {
|
for(const peer of this.clients) {
|
||||||
if(peer.peerId === data.peerId) {
|
if(peer.peerId === data.peerId) {
|
||||||
// already connected from different interface
|
// already connected from different interface
|
||||||
@ -544,6 +549,13 @@ class p2p {
|
|||||||
return;
|
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) {
|
for(let peer of this.peers) {
|
||||||
if(peer.peerId === data.peerId) {
|
if(peer.peerId === data.peerId) {
|
||||||
// already connected from different interface
|
// already connected from different interface
|
||||||
|
Loading…
Reference in New Issue
Block a user