[Libreoffice-commits] online.git: loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp

Henry Castro hcastro at collabora.com
Wed Aug 5 17:06:08 PDT 2015


 loolwsd/LOOLSession.cpp |    2 +-
 loolwsd/LOOLWSD.cpp     |    6 +++---
 loolwsd/LOOLWSD.hpp     |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 1c0153d5e0350ee71437dd14a977f8f7f6f9d61a
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Aug 5 20:01:39 2015 -0400

    loolwsd: ensure one child when debugging
    
    when used with --test option:
    ./loolwsd --test --systemplate=${SYSTEMPLATE} --lotemplate=${MASTER}/instdir
    --childroot=${ROOTFORJAILS}
    
    ensure that one child is created and attach to it easily to debug lokit
    messages

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index ac299f4..10e299f 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -470,7 +470,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;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 84f6bf5..6d640d6 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -426,6 +426,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;
@@ -434,7 +435,6 @@ const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
 const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
 
 LOOLWSD::LOOLWSD() :
-    _doTest(false),
     _childId(0)
 {
 }
@@ -543,7 +543,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")
@@ -1032,7 +1032,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 7b5bfd9..494fd8c 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;
@@ -65,7 +66,6 @@ private:
     int  createComponent();
     int  createDesktop();
 
-    bool _doTest;
     Poco::UInt64 _childId;
     static int _numPreSpawnedChildren;
     static std::mutex _rngMutex;


More information about the Libreoffice-commits mailing list