mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-30 08:04:04 +00:00
Add beacon broadcasting back into Node.
This commit is contained in:
parent
aeb4b42ab3
commit
c9af603b9f
@ -73,6 +73,7 @@ Node::Node(
|
||||
_startTimeAfterInactivity(0),
|
||||
_lastPingCheck(0),
|
||||
_lastHousekeepingRun(0),
|
||||
_lastBeacon(0),
|
||||
_coreDesperation(0)
|
||||
{
|
||||
_newestVersionSeen[0] = ZEROTIER_ONE_VERSION_MAJOR;
|
||||
@ -252,6 +253,15 @@ ZT1_ResultCode Node::processBackgroundTasks(uint64_t now,uint64_t *nextBackgroun
|
||||
} catch ( ... ) {
|
||||
return ZT1_RESULT_FATAL_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
if ((now - _lastBeacon) >= ZT_BEACON_INTERVAL) {
|
||||
_lastBeacon = now;
|
||||
char beacon[13];
|
||||
*(reinterpret_cast<uint32_t *>(beacon)) = RR->prng->next32();
|
||||
*(reinterpret_cast<uint32_t *>(beacon + 4)) = RR->prng->next32();
|
||||
RR->identity.address().copyTo(beacon + 8,5);
|
||||
putPacket(ZT_DEFAULTS.v4Broadcast,beacon,13,0);
|
||||
}
|
||||
}
|
||||
|
||||
if ((now - _lastHousekeepingRun) >= ZT_HOUSEKEEPING_PERIOD) {
|
||||
|
@ -252,6 +252,7 @@ private:
|
||||
uint64_t _startTimeAfterInactivity;
|
||||
uint64_t _lastPingCheck;
|
||||
uint64_t _lastHousekeepingRun;
|
||||
uint64_t _lastBeacon;
|
||||
unsigned int _coreDesperation;
|
||||
unsigned int _newestVersionSeen[3]; // major, minor, revision
|
||||
bool _online;
|
||||
|
Loading…
x
Reference in New Issue
Block a user