More toward GitHub issue #56
This commit is contained in:
parent
c9294c1a78
commit
aee742e767
12 changed files with 113 additions and 27 deletions
|
@ -62,6 +62,7 @@
|
|||
#include "Identity.hpp"
|
||||
#include "Topology.hpp"
|
||||
#include "SocketManager.hpp"
|
||||
#include "Packet.hpp"
|
||||
#include "Switch.hpp"
|
||||
#include "EthernetTap.hpp"
|
||||
#include "CMWC4096.hpp"
|
||||
|
@ -534,6 +535,7 @@ Node::ReasonForTermination Node::run()
|
|||
uint64_t lastNetworkFingerprintCheck = 0;
|
||||
uint64_t lastMulticastCheck = 0;
|
||||
uint64_t lastSupernodePingCheck = 0;
|
||||
uint64_t lastBeacon = 0;
|
||||
long lastDelayDelta = 0;
|
||||
|
||||
uint64_t networkConfigurationFingerprint = 0;
|
||||
|
@ -676,6 +678,18 @@ Node::ReasonForTermination Node::run()
|
|||
_r->updater->checkIfMaxIntervalExceeded(now);
|
||||
}
|
||||
|
||||
// Send beacons to physical local LANs
|
||||
if ((resynchronize)||((now - lastBeacon) >= ZT_BEACON_INTERVAL)) {
|
||||
lastBeacon = now;
|
||||
char bcn[ZT_PROTO_BEACON_LENGTH];
|
||||
*((uint32_t *)(bcn)) = _r->prng->next32();
|
||||
*((uint32_t *)(bcn + 4)) = _r->prng->next32();
|
||||
_r->identity.address().copyTo(bcn + ZT_PROTO_BEACON_IDX_ADDRESS,ZT_ADDRESS_LENGTH);
|
||||
TRACE("sending LAN beacon to %s",ZT_DEFAULTS.v4Broadcast.toString().c_str());
|
||||
_r->antiRec->logOutgoingZT(bcn,ZT_PROTO_BEACON_LENGTH);
|
||||
_r->sm->send(ZT_DEFAULTS.v4Broadcast,false,false,bcn,ZT_PROTO_BEACON_LENGTH);
|
||||
}
|
||||
|
||||
// Sleep for loop interval or until something interesting happens.
|
||||
try {
|
||||
unsigned long delay = std::min((unsigned long)ZT_MAX_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue