mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Add ping(), and a logic fix in SelfAwareness.
This commit is contained in:
parent
24608d5ca3
commit
0a90681849
2 changed files with 20 additions and 1 deletions
|
@ -182,6 +182,23 @@ public:
|
||||||
*/
|
*/
|
||||||
void attemptToContactAt(const RuntimeEnvironment *RR,const InetAddress &atAddress,unsigned int linkDesperation,uint64_t now);
|
void attemptToContactAt(const RuntimeEnvironment *RR,const InetAddress &atAddress,unsigned int linkDesperation,uint64_t now);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a HELLO to all active direct paths
|
||||||
|
*
|
||||||
|
* @param RR Runtime environment
|
||||||
|
* @param now Current time
|
||||||
|
*/
|
||||||
|
inline void ping(const RuntimeEnvironment *RR,uint64_t now)
|
||||||
|
{
|
||||||
|
unsigned int np = _numPaths;
|
||||||
|
for(unsigned int p=0;p<np;++p) {
|
||||||
|
if (_paths[p].active(now)) {
|
||||||
|
attemptToContactAt(RR,_paths[p].address(),_paths[p].desperation(now),now);
|
||||||
|
_paths[p].sent(now);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return All known direct paths to this peer
|
* @return All known direct paths to this peer
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -78,7 +78,9 @@ void SelfAwareness::iam(const InetAddress &reporterPhysicalAddress,const InetAdd
|
||||||
else {
|
else {
|
||||||
Mutex::Lock _l(_lock);
|
Mutex::Lock _l(_lock);
|
||||||
InetAddress &lastPhy = _lastPhysicalAddress[scope - 1];
|
InetAddress &lastPhy = _lastPhysicalAddress[scope - 1];
|
||||||
if ((lastPhy)&&(lastPhy != myPhysicalAddress)) {
|
if (!lastPhy) {
|
||||||
|
lastPhy = myPhysicalAddress;
|
||||||
|
} else if (lastPhy != myPhysicalAddress) {
|
||||||
lastPhy = myPhysicalAddress;
|
lastPhy = myPhysicalAddress;
|
||||||
_ResetWithinScope rset(RR,RR->node->now(),(InetAddress::IpScope)scope);
|
_ResetWithinScope rset(RR,RR->node->now(),(InetAddress::IpScope)scope);
|
||||||
RR->topology->eachPeer<_ResetWithinScope &>(rset);
|
RR->topology->eachPeer<_ResetWithinScope &>(rset);
|
||||||
|
|
Loading…
Add table
Reference in a new issue