mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-23 09:25:32 +00:00
Peers and paths
This commit is contained in:
@ -336,14 +336,16 @@ extern "C" ZT_GoNode *ZT_GoNode_new(const char *workingPath)
|
||||
gn->run = true;
|
||||
|
||||
gn->backgroundTaskThread = std::thread([gn] {
|
||||
int64_t lastScannedMulticastGroups = 0;
|
||||
int64_t lastCheckedTaps = 0;
|
||||
while (gn->run) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
const int64_t now = OSUtils::now();
|
||||
|
||||
if (now >= gn->nextBackgroundTaskDeadline)
|
||||
gn->node->processBackgroundTasks(nullptr,now,&(gn->nextBackgroundTaskDeadline));
|
||||
if ((now - lastScannedMulticastGroups) > 5000) {
|
||||
lastScannedMulticastGroups = now;
|
||||
|
||||
if ((now - lastCheckedTaps) > 10000) {
|
||||
lastCheckedTaps = now;
|
||||
std::vector<MulticastGroup> added,removed;
|
||||
std::lock_guard<std::mutex> tl(gn->taps_l);
|
||||
for(auto t=gn->taps.begin();t!=gn->taps.end();++t) {
|
||||
@ -354,6 +356,8 @@ extern "C" ZT_GoNode *ZT_GoNode_new(const char *workingPath)
|
||||
goHandleTapAddedMulticastGroup(gn,(ZT_GoTap *)t->second.get(),t->first,g->mac().toInt(),g->adi());
|
||||
for(auto g=removed.begin();g!=removed.end();++g)
|
||||
goHandleTapRemovedMulticastGroup(gn,(ZT_GoTap *)t->second.get(),t->first,g->mac().toInt(),g->adi());
|
||||
|
||||
t->second->syncRoutes();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -705,8 +709,3 @@ extern "C" int ZT_GoTap_removeRoute(ZT_GoTap *tap,int targetAf,const void *targe
|
||||
}
|
||||
return reinterpret_cast<EthernetTap *>(tap)->removeRoute(target,via,metric);
|
||||
}
|
||||
|
||||
extern "C" int ZT_GoTap_syncRoutes(ZT_GoTap *tap)
|
||||
{
|
||||
return reinterpret_cast<EthernetTap *>(tap)->syncRoutes();
|
||||
}
|
||||
|
Reference in New Issue
Block a user