summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-07 15:06:02 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-01-07 15:06:02 -0800
commitc1256fff5b0c09359531fc09bc8235c6f11c800d (patch)
treee7bf6476feb584048bc722eab3955061d5d3c981 /node
parentddb77b14547a8895151505721e6d578122d7f160 (diff)
downloadinfinitytier-c1256fff5b0c09359531fc09bc8235c6f11c800d.tar.gz
infinitytier-c1256fff5b0c09359531fc09bc8235c6f11c800d.zip
Remove some legacy code from the core loop.
Diffstat (limited to 'node')
-rw-r--r--node/Node.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index cbea5694..c77db4aa 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -416,11 +416,6 @@ Node::ReasonForTermination Node::run()
}
Utils::lockDownFile(identitySecretPath.c_str(),false);
- // Clean up some obsolete files if present -- this will be removed later
- Utils::rm((_r->homePath + ZT_PATH_SEPARATOR_S + "status"));
- Utils::rm((_r->homePath + ZT_PATH_SEPARATOR_S + "thisdeviceismine"));
- Utils::rm((_r->homePath + ZT_PATH_SEPARATOR_S + "peer.db"));
-
// Make sure networks.d exists
#ifdef __WINDOWS__
CreateDirectoryA((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),NULL);
@@ -458,9 +453,9 @@ Node::ReasonForTermination Node::run()
}
_r->node = this;
#ifdef ZT_AUTO_UPDATE
- if (ZT_DEFAULTS.updateLatestNfoURL.length())
+ if (ZT_DEFAULTS.updateLatestNfoURL.length()) {
_r->updater = new SoftwareUpdater(_r);
- else {
+ } else {
LOG("WARNING: unable to enable software updates: latest .nfo URL from ZT_DEFAULTS is empty (does this platform actually support software updates?)");
}
#endif
@@ -502,7 +497,14 @@ Node::ReasonForTermination Node::run()
// Core I/O loop
try {
+ /* Shut down if this file exists but fails to open. This is used on Mac to
+ * shut down automatically on .app deletion by symlinking this to the
+ * Info.plist file inside the ZeroTier One application. This causes the
+ * service to die when the user throws away the app, allowing uninstallation
+ * in the natural Mac way. */
std::string shutdownIfUnreadablePath(_r->homePath + ZT_PATH_SEPARATOR_S + "shutdownIfUnreadable");
+
+ // Times we last did stuff... used for firing off periodic events.
uint64_t lastNetworkAutoconfCheck = Utils::now() - 5000; // check autoconf again after 5s for startup
uint64_t lastPingCheck = 0;
uint64_t lastClean = Utils::now(); // don't need to do this immediately
@@ -515,7 +517,7 @@ Node::ReasonForTermination Node::run()
if (Utils::fileExists(shutdownIfUnreadablePath.c_str(),false)) {
FILE *tmpf = fopen(shutdownIfUnreadablePath.c_str(),"r");
if (!tmpf)
- return impl->terminateBecause(Node::NODE_NORMAL_TERMINATION,"shutdownIfUnreadable was not readable");
+ return impl->terminateBecause(Node::NODE_NORMAL_TERMINATION,"shutdownIfUnreadable exists but is not readable");
fclose(tmpf);
}