loolwsd/LOOLWSD.cpp | 14 ++++++++++++++ loolwsd/LOOLWSD.hpp | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-)
New commits: commit 6dafcc753f64fc70468b4336166b7893057ab45f Author: Henry Castro <[email protected]> Date: Fri Jul 24 14:10:24 2015 -0400 loolwsd: process sleep for amount of time ... specified by MAINTENANCE_INTERVAL diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 4bccf72..7684d82 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -413,6 +413,7 @@ private: }; int LOOLWSD::portNumber = DEFAULT_CLIENT_PORT_NUMBER; +int LOOLWSD::timeoutCounter = 0; std::string LOOLWSD::cache = LOOLWSD_CACHEDIR; std::string LOOLWSD::sysTemplate; std::string LOOLWSD::loTemplate; @@ -954,6 +955,13 @@ void LOOLWSD::desktopMain() if (createComponent() < 0 ) break; } + + ++timeoutCounter; + if (timeoutCounter == INTERVAL_PROBES) + { + timeoutCounter = 0; + sleep(MAINTENANCE_INTERVAL); + } } // Terminate child processes @@ -1098,6 +1106,12 @@ int LOOLWSD::main(const std::vector<std::string>& args) else if (pid < 0) std::cout << Util::logPrefix() << "Child error: " << strerror(errno); + ++timeoutCounter; + if (timeoutCounter == INTERVAL_PROBES) + { + timeoutCounter = 0; + sleep(MAINTENANCE_INTERVAL); + } } // Terminate child processes diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp index 099de04..2824409 100644 --- a/loolwsd/LOOLWSD.hpp +++ b/loolwsd/LOOLWSD.hpp @@ -31,6 +31,7 @@ public: // An Application is a singleton anyway, so just keep these as // statics static int portNumber; + static int timeoutCounter; static std::string cache; static std::string sysTemplate; static std::string loTemplate; @@ -41,7 +42,8 @@ public: static const int DEFAULT_CLIENT_PORT_NUMBER = 9980; static const int MASTER_PORT_NUMBER = 9981; - static const int FILE_PORT_NUMBER = 9979; + static const int INTERVAL_PROBES = 10; + static const int MAINTENANCE_INTERVAL = 1000000; static const std::string CHILD_URI; static const std::string PIDLOG; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
