[Libreoffice-commits] online.git: Branch 'private/hcvcastro/forking' - loolwsd/LOOLBroker.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/MasterProcessSession.cpp

Henry Castro hcastro at collabora.com
Tue Aug 4 19:50:52 PDT 2015


 loolwsd/LOOLBroker.cpp           |    7 -------
 loolwsd/LOOLWSD.cpp              |    6 +++---
 loolwsd/LOOLWSD.hpp              |    2 +-
 loolwsd/MasterProcessSession.cpp |    2 +-
 4 files changed, 5 insertions(+), 12 deletions(-)

New commits:
commit 4c07b05455cedd77f9ff0b3b04c643b0c623cdc3
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue Aug 4 22:50:14 2015 -0400

    loolwsd: ensure one child when debugging.

diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 478931b..c8a59f0 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -394,13 +394,6 @@ int main(int argc, char** argv)
     dropCapability();
 #endif
 
-    if (std::getenv("SLEEPFORDEBUGGER"))
-    {
-        std::cout << Util::logPrefix() <<  "Sleeping " << std::getenv("SLEEPFORDEBUGGER") << " seconds, " <<
-            "attach process " << Process::id() << " in debugger now." << std::endl;
-        Thread::sleep(std::stoul(std::getenv("SLEEPFORDEBUGGER")) * 1000);
-    }
-
     startupLibreOfficeKit(_numPreSpawnedChildren, loSubPath, _childId);
 
     while (_childProcesses.size() > 0)
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 7c0bb02..ef00532 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -420,6 +420,7 @@ Poco::NamedMutex LOOLWSD::_namedMutexLOOL("loolwsd");
 Poco::SharedMemory LOOLWSD::_sharedForkChild("loolwsd", sizeof(bool), Poco::SharedMemory::AM_WRITE);
 
 int LOOLWSD::_numPreSpawnedChildren = 10;
+bool LOOLWSD::doTest = false;
 #if ENABLE_DEBUG
 bool LOOLWSD::runningAsRoot = false;
 int LOOLWSD::uid = 0;
@@ -428,7 +429,6 @@ const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
 const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
 
 LOOLWSD::LOOLWSD() :
-    _doTest(false),
     _childId(0)
 {
 }
@@ -537,7 +537,7 @@ void LOOLWSD::handleOption(const std::string& name, const std::string& value)
     else if (name == "numprespawns")
         _numPreSpawnedChildren = std::stoi(value);
     else if (name == "test")
-        _doTest = true;
+        LOOLWSD::doTest = true;
     else if (name == "child")
         _childId = std::stoull(value);
     else if (name == "jail")
@@ -614,7 +614,7 @@ int LOOLWSD::main(const std::vector<std::string>& args)
     if (portNumber == MASTER_PORT_NUMBER)
         throw IncompatibleOptionsException("port");
 
-    if (_doTest)
+    if (LOOLWSD::doTest)
         _numPreSpawnedChildren = 1;
 
     // log pid information
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 1ad7187..5ef0099 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -32,6 +32,7 @@ public:
     // statics
     static int portNumber;
     static int timeoutCounter;
+    static bool doTest;
     static std::string cache;
     static std::string sysTemplate;
     static std::string loTemplate;
@@ -60,7 +61,6 @@ private:
     void startupBroker(int nBroker);
     int  createBroker();
 
-    bool _doTest;
     Poco::UInt64 _childId;
     static int _numPreSpawnedChildren;
     static std::mutex _rngMutex;
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 8d18cd9..5d4e49d 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -398,7 +398,7 @@ void MasterProcessSession::dispatchChild()
     _availableChildSessions.erase(childSession);
     lock.unlock();
 
-    if (_availableChildSessions.size() == 0)
+    if (_availableChildSessions.size() == 0 && !LOOLWSD::doTest)
     {
         LOOLWSD::_namedMutexLOOL.lock();
         std::cout << Util::logPrefix() << "No available child sessions, queue new child session" << std::endl;


More information about the Libreoffice-commits mailing list