summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-05 12:34:54 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-08-05 12:34:54 -0400
commit3368330b777da9561539c04ea589aa7060e1d569 (patch)
treecd85bda86aa5347e773bc5386b8fa7ada6183c7d /node/Node.cpp
parentb9aeec9f298415746f92da8444014093bb2a33c2 (diff)
downloadinfinitytier-3368330b777da9561539c04ea589aa7060e1d569.tar.gz
infinitytier-3368330b777da9561539c04ea589aa7060e1d569.zip
Poll for network autoconf, and a few other documentation changes.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index f42e1bad..ef2a801c 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -406,6 +406,7 @@ Node::ReasonForTermination Node::run()
#endif
try {
+ uint64_t lastNetworkAutoconfCheck = 0;
uint64_t lastPingCheck = 0;
uint64_t lastClean = Utils::now(); // don't need to do this immediately
uint64_t lastNetworkFingerprintCheck = 0;
@@ -441,6 +442,17 @@ Node::ReasonForTermination Node::run()
}
}
+ // Request configuration for unconfigured nets, or nets with out of date
+ // configuration information.
+ if ((resynchronize)||((now - lastNetworkAutoconfCheck) >= ZT_NETWORK_AUTOCONF_CHECK_DELAY)) {
+ lastNetworkAutoconfCheck = now;
+ std::vector< SharedPtr<Network> > nets(_r->nc->networks());
+ for(std::vector< SharedPtr<Network> >::iterator n(nets.begin());n!=nets.end();++n) {
+ if ((now - (*n)->lastConfigUpdate()) >= ZT_NETWORK_AUTOCONF_DELAY)
+ (*n)->requestConfiguration();
+ }
+ }
+
// Periodically check for changes in our local multicast subscriptions and broadcast
// those changes to peers.
if ((resynchronize)||((now - lastMulticastCheck) >= ZT_MULTICAST_LOCAL_POLL_PERIOD)) {
@@ -477,9 +489,9 @@ Node::ReasonForTermination Node::run()
lastPingCheck = now;
try {
if (_r->topology->amSupernode()) {
- // Supernodes are so super they don't even have to ping out. Everyone
- // comes to them! They're also never firewalled, so they don't
- // send firewall openers.
+ // Supernodes are so super they don't even have to ping out, since
+ // all nodes ping them. They're also never firewalled so they
+ // don't need firewall openers. They just ping each other.
std::vector< SharedPtr<Peer> > sns(_r->topology->supernodePeers());
for(std::vector< SharedPtr<Peer> >::const_iterator p(sns.begin());p!=sns.end();++p) {
if ((now - (*p)->lastDirectSend()) > ZT_PEER_DIRECT_PING_DELAY)
@@ -532,7 +544,7 @@ Node::ReasonForTermination Node::run()
unsigned long delay = std::min((unsigned long)ZT_MIN_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks());
uint64_t start = Utils::now();
_r->mainLoopWaitCondition.wait(delay);
- lastDelayDelta = (long)(Utils::now() - start) - (long)delay;
+ lastDelayDelta = (long)(Utils::now() - start) - (long)delay; // used to detect sleep/wake
} catch (std::exception &exc) {
LOG("unexpected exception running Switch doTimerTasks: %s",exc.what());
} catch ( ... ) {