[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLBroker.cpp
Henry Castro
hcastro at collabora.com
Sun Sep 27 14:46:01 PDT 2015
loolwsd/LOOLBroker.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
New commits:
commit 361a190cdf3696f12d80539beedce0edc344d22d
Author: Henry Castro <hcastro at collabora.com>
Date: Sun Sep 27 17:45:13 2015 -0400
loolwsd: fork new child if new client requests
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index aaeede4..9097595 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -65,8 +65,10 @@ const std::string BROKER_PREFIX = "/tmp/lokit";
static int readerChild = -1;
static int readerBroker = -1;
+static unsigned int forkCounter = 0;
static unsigned int childCounter = 0;
+static std::mutex forkMutex;
static std::map<Poco::Process::PID, int> _childProcesses;
namespace
@@ -530,6 +532,17 @@ int main(int argc, char** argv)
else if (pid < 0)
std::cout << Util::logPrefix() << "Child error: " << strerror(errno) << std::endl;
+ if ( forkCounter > 0 )
+ {
+ forkMutex.lock();
+ forkCounter -= 1;
+
+ if (createLibreOfficeKit(sharePages, loSubPath, _childId) < 0 )
+ std::cout << Util::logPrefix() << "fork falied: " << strerror(errno) << std::endl;
+
+ forkMutex.unlock();
+ }
+
++timeoutCounter;
if (timeoutCounter == INTERVAL_PROBES)
{
More information about the Libreoffice-commits
mailing list