[Libreoffice-commits] online.git: loolwsd/LOOLBroker.cpp
Henry Castro
hcastro at collabora.com
Tue Jan 5 04:52:49 PST 2016
loolwsd/LOOLBroker.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
New commits:
commit fe3b4fc9a48a6caa36ccaffc739e6a40ec7c3832
Author: Henry Castro <hcastro at collabora.com>
Date: Tue Jan 5 08:51:05 2016 -0400
loolwsd: when no available child sessions, pre spawns more children
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index e94d6c3..1ec6ea3 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -67,6 +67,7 @@ static int readerBroker = -1;
static unsigned int forkCounter = 0;
static unsigned int childCounter = 0;
+static unsigned int numPreSpawnedChildren = 0;
static std::mutex forkMutex;
static std::map<Process::PID, int> _childProcesses;
@@ -307,8 +308,8 @@ public:
}
else
{
- Log::info("No children available, creating a new one.");
- forkCounter++;
+ Log::info("No children available, creating [" + std::to_string(numPreSpawnedChildren) + "] childs");
+ forkCounter = numPreSpawnedChildren;
}
}
}
@@ -531,7 +532,6 @@ int main(int argc, char** argv)
std::string loSubPath;
std::string sysTemplate;
std::string loTemplate;
- int numPreSpawnedChildren = 0;
for (int i = 0; i < argc; ++i)
{
@@ -772,10 +772,10 @@ int main(int argc, char** argv)
else if (pid < 0)
Log::error("Error: Child error.");
- if ( forkCounter > 0 )
+ if (forkCounter > 0)
{
forkMutex.lock();
- forkCounter -= 1;
+ forkCounter--;
if (createLibreOfficeKit(sharePages, loSubPath, childId) < 0)
Log::error("Error: fork falied.");
More information about the Libreoffice-commits
mailing list