loolwsd/LOOLBroker.cpp | 12 ++++++++++++ loolwsd/LOOLWSD.cpp | 7 +++++++ loolwsd/LOOLWSD.hpp | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-)
New commits: commit 20601a351338d70868df45260b0584691282984c Author: Henry Castro <hcas...@collabora.com> Date: Fri Jul 24 13:09:12 2015 -0400 loolwsd: sleep process with time interval. diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 6eb2b94..56a9238 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -23,6 +23,9 @@ #include "Util.hpp" +#define INTERVAL_PROBES 10 +#define MAINTENANCE_INTERVAL 1000000 + using Poco::Path; using Poco::File; using Poco::ThreadLocal; @@ -229,6 +232,8 @@ static void startupLibreOfficeKit(int nLOKits, std::string loSubPath, Poco::UInt } } +static int timeoutCounter = 0; + // Broker process int main(int argc, char** argv) { @@ -431,6 +436,13 @@ int main(int argc, char** argv) if (createLibreOfficeKit(loSubPath, _childId) < 0 ) break; } + + ++timeoutCounter; + if (timeoutCounter == INTERVAL_PROBES) + { + timeoutCounter = 0; + sleep(MAINTENANCE_INTERVAL); + } } // Terminate child processes diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index ed9f6cc..9d5115e 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -407,6 +407,7 @@ public: }; 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; @@ -688,6 +689,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 1d1066e..431df53 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 libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits