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

Henry Castro hcastro at collabora.com
Wed Aug 5 13:21:16 PDT 2015


 loolwsd/LOOLKit.cpp              |    2 +-
 loolwsd/LOOLWSD.cpp              |    1 +
 loolwsd/LOOLWSD.hpp              |    1 +
 loolwsd/MasterProcessSession.cpp |   12 +++++++++++-
 4 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 76dba8c5b414815a67ca44c11cbbd08734cbd149
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Aug 5 16:18:28 2015 -0400

    loolwsd: create lokit process id logs

diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 953b6a3..fa5e9ab 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -151,7 +151,7 @@ int main(int argc, char** argv)
 
         ws->setReceiveTimeout(0);
 
-        std::string hello("child " + std::to_string(_childId));
+        std::string hello("child " + std::to_string(_childId) + " " + std::to_string(Process::id()));
         session->sendTextFrame(hello);
 
         tsqueue<std::string> queue;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index ef00532..84cb604 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -427,6 +427,7 @@ int LOOLWSD::uid = 0;
 #endif
 const std::string LOOLWSD::CHILD_URI = "/loolws/child/";
 const std::string LOOLWSD::PIDLOG = "/tmp/loolwsd.pid";
+const std::string LOOLWSD::LOKIT_PIDLOG = "/tmp/lokit.pid";
 
 LOOLWSD::LOOLWSD() :
     _childId(0)
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 5ef0099..044ea05 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -47,6 +47,7 @@ public:
     static const int MAINTENANCE_INTERVAL = 1;
     static const std::string CHILD_URI;
     static const std::string PIDLOG;
+    static const std::string LOKIT_PIDLOG;
     static Poco::NamedMutex _namedMutexLOOL;
 
 protected:
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 5d4e49d..5670858 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -34,6 +34,7 @@
 #include <Poco/URI.h>
 #include <Poco/File.h>
 #include <Poco/Exception.h>
+#include <Poco/FileStream.h>
 
 #include "MasterProcessSession.hpp"
 #include "Util.hpp"
@@ -154,13 +155,14 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
             sendTextFrame("error: cmd=child kind=invalid");
             return false;
         }
-        if (tokens.count() != 2)
+        if (tokens.count() != 3)
         {
             sendTextFrame("error: cmd=child kind=syntax");
             return false;
         }
 
         UInt64 childId = std::stoull(tokens[1]);
+        Process::PID pidChild = std::stoull(tokens[2]);
 
         std::unique_lock<std::mutex> lock(_availableChildSessionMutex);
         _availableChildSessions.insert(shared_from_this());
@@ -168,6 +170,14 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
         _childId = childId;
         lock.unlock();
         _availableChildSessionCV.notify_one();
+
+        // log first lokit child pid information
+        if ( LOOLWSD::doTest )
+        {
+            Poco::FileOutputStream filePID(LOOLWSD::LOKIT_PIDLOG);
+            if (filePID.good())
+                filePID << pidChild;
+        }
     }
     else if (_kind == Kind::ToPrisoner)
     {


More information about the Libreoffice-commits mailing list