fix(relay): ignore some situations when relay not needed

This commit is contained in:
Alexey Kasyanchuk 2020-01-08 21:49:51 +03:00
parent 2e05bc9e68
commit ab5303ecae

View File

@ -165,6 +165,7 @@ class p2p {
if (this.p2pStatus === 0) {
// switch to direct status, otherwise it's relay
this.p2pStatus = 2
this.relay.client = false;
this.send('p2pStatus', this.p2pStatus)
}
})
@ -347,7 +348,10 @@ class p2p {
}
else
{
logT('relay', 'tcp p2p port is unreachable, using relay client')
logT('relay', 'tcp p2p port is unreachable')
if(this.p2pStatus === 0)
{
logT('relay', 'using relay client')
this.relay.client = true;
// try reconnect to new relay server
let candidatePeer = this.peersList().filter(peer => peer.relay && peer.relay.server)
@ -358,6 +362,11 @@ class p2p {
this.p2pStatus = 0
this.send('p2pStatus', this.p2pStatus)
}
else
{
this.send('p2pStatus', this.p2pStatus)
}
}
})
}