mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fix for 100% cpu issue.
This commit is contained in:
parent
f1c0563c40
commit
2487a8bede
1 changed files with 24 additions and 26 deletions
|
@ -166,33 +166,31 @@ void Peer::received(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (!pathAlreadyKnown) && (RR->node->shouldUsePathForZeroTierTraffic(tPtr,_id.address(),path->localAddress(),path->address())) ) {
|
if ( (!pathAlreadyKnown) && (RR->node->shouldUsePathForZeroTierTraffic(tPtr,_id.address(),path->localAddress(),path->address())) ) {
|
||||||
if (verb == Packet::VERB_OK) {
|
Mutex::Lock _l(_paths_m);
|
||||||
Mutex::Lock _l(_paths_m);
|
_PeerPath *potentialNewPeerPath = (_PeerPath *)0;
|
||||||
if (path->address().ss_family == AF_INET) {
|
if (path->address().ss_family == AF_INET) {
|
||||||
if ( (!_v4Path.p) || (!_v4Path.p->alive(now)) || ((_v4Path.p->address() != _v4ClusterPreferred)&&(path->preferenceRank() >= _v4Path.p->preferenceRank())) ) {
|
if ( (!_v4Path.p) || (!_v4Path.p->alive(now)) || ((_v4Path.p->address() != _v4ClusterPreferred)&&(path->preferenceRank() >= _v4Path.p->preferenceRank())) ) {
|
||||||
_v4Path.lr = now;
|
potentialNewPeerPath = &_v4Path;
|
||||||
_v4Path.p = path;
|
}
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
} else if (path->address().ss_family == AF_INET6) {
|
||||||
_v4Path.localClusterSuboptimal = isClusterSuboptimalPath;
|
if ( (!_v6Path.p) || (!_v6Path.p->alive(now)) || ((_v6Path.p->address() != _v6ClusterPreferred)&&(path->preferenceRank() >= _v6Path.p->preferenceRank())) ) {
|
||||||
if (RR->cluster)
|
potentialNewPeerPath = &_v6Path;
|
||||||
RR->cluster->broadcastHavePeer(_id);
|
}
|
||||||
#endif
|
}
|
||||||
}
|
if (potentialNewPeerPath) {
|
||||||
} else if (path->address().ss_family == AF_INET6) {
|
if (verb == Packet::VERB_OK) {
|
||||||
if ( (!_v6Path.p) || (!_v6Path.p->alive(now)) || ((_v6Path.p->address() != _v6ClusterPreferred)&&(path->preferenceRank() >= _v6Path.p->preferenceRank())) ) {
|
potentialNewPeerPath->lr = now;
|
||||||
_v6Path.lr = now;
|
potentialNewPeerPath->p = path;
|
||||||
_v6Path.p = path;
|
#ifdef ZT_ENABLE_CLUSTER
|
||||||
#ifdef ZT_ENABLE_CLUSTER
|
potentialNewPeerPath->localClusterSuboptimal = isClusterSuboptimalPath;
|
||||||
_v6Path.localClusterSuboptimal = isClusterSuboptimalPath;
|
if (RR->cluster)
|
||||||
if (RR->cluster)
|
RR->cluster->broadcastHavePeer(_id);
|
||||||
RR->cluster->broadcastHavePeer(_id);
|
#endif
|
||||||
#endif
|
} else {
|
||||||
}
|
TRACE("got %s via unknown path %s(%s), confirming...",Packet::verbString(verb),_id.address().toString().c_str(),path->address().toString().c_str());
|
||||||
|
attemptToContactAt(tPtr,path->localAddress(),path->address(),now,true,path->nextOutgoingCounter());
|
||||||
|
path->sent(now);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
TRACE("got %s via unknown path %s(%s), confirming...",Packet::verbString(verb),_id.address().toString().c_str(),path->address().toString().c_str());
|
|
||||||
attemptToContactAt(tPtr,path->localAddress(),path->address(),now,true,path->nextOutgoingCounter());
|
|
||||||
path->sent(now);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this->trustEstablished(now)) {
|
} else if (this->trustEstablished(now)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue