diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-04-09 11:55:24 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-04-09 11:55:24 -0700 |
| commit | 28a6d328a55d90ee21f5fa03e5aae447de7f1268 (patch) | |
| tree | c2f05c3813c08b19bb7990c0ad47b97c35adfcda /node/Node.cpp | |
| parent | dd404b8ba3d00642e3162969eb4831baa49f355a (diff) | |
| download | infinitytier-28a6d328a55d90ee21f5fa03e5aae447de7f1268.tar.gz infinitytier-28a6d328a55d90ee21f5fa03e5aae447de7f1268.zip | |
Some adjustments to TCP logic for GitHub issue #60
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index b87195b1..2ae61136 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -546,14 +546,18 @@ Node::ReasonForTermination Node::run() _r->timeOfLastResynchronize = Utils::now(); while (impl->reasonForTermination == NODE_RUNNING) { - //TRACE("--- BEGIN main I/O loop"); - + /* This is how the service automatically shuts down when the OSX .app is + * thrown in the trash. It's not used on any other platform for now but + * could do similar things. It's disabled on Windows since it doesn't really + * work there. */ +#ifdef __UNIX_LIKE__ if (Utils::fileExists(shutdownIfUnreadablePath.c_str(),false)) { FILE *tmpf = fopen(shutdownIfUnreadablePath.c_str(),"r"); if (!tmpf) return impl->terminateBecause(Node::NODE_NORMAL_TERMINATION,"shutdownIfUnreadable exists but is not readable"); fclose(tmpf); } +#endif uint64_t now = Utils::now(); bool resynchronize = false; @@ -664,7 +668,7 @@ Node::ReasonForTermination Node::run() // Sleep for loop interval or until something interesting happens. try { - unsigned long delay = std::min((unsigned long)ZT_MIN_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks()); + unsigned long delay = std::min((unsigned long)ZT_MAX_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks()); uint64_t start = Utils::now(); _r->sm->poll(delay); lastDelayDelta = (long)(Utils::now() - start) - (long)delay; // used to detect sleep/wake |
