[Libreoffice-commits] online.git: loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp
Henry Castro
hcastro at collabora.com
Wed Nov 25 19:17:29 PST 2015
loolwsd/LOOLSession.cpp | 2 +-
loolwsd/LOOLWSD.cpp | 17 ++++++-----------
loolwsd/LOOLWSD.hpp | 3 +--
3 files changed, 8 insertions(+), 14 deletions(-)
New commits:
commit c0fbf5ebf995d9390b776d566565cc52346bc2b9
Author: Henry Castro <hcastro at collabora.com>
Date: Wed Nov 25 23:17:08 2015 -0400
loolwsd: remove child root folder when it is a gracefull shut down
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index d517651..1bac381 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -325,7 +325,7 @@ bool MasterProcessSession::handleInput(const char *buffer, int length)
std::unique_lock<std::mutex> lock(_availableChildSessionMutex);
_availableChildSessions.insert(shared_from_this());
std::cout << Util::logPrefix() << "Inserted " << this << " id=" << childId << " into _availableChildSessions, size=" << _availableChildSessions.size() << std::endl;
- _childId = childId;
+ LOOLWSD::_childId = _childId = childId;
lock.unlock();
_availableChildSessionCV.notify_one();
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index a814de1..b1f0138 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -573,6 +573,7 @@ private:
int LOOLWSD::portNumber = DEFAULT_CLIENT_PORT_NUMBER;
int LOOLWSD::timeoutCounter = 0;
+Poco::UInt64 LOOLWSD::_childId = 0;
std::string LOOLWSD::cache = LOOLWSD_CACHEDIR;
std::string LOOLWSD::sysTemplate;
std::string LOOLWSD::loTemplate;
@@ -595,8 +596,7 @@ 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)
+LOOLWSD::LOOLWSD()
{
}
@@ -1245,10 +1245,6 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
filePID << Process::id();
}
- std::unique_lock<std::mutex> rngLock(_rngMutex);
- _childId = (((Poco::UInt64)_rng.next()) << 32) | _rng.next() | 1;
- rngLock.unlock();
-
_namedMutexLOOL.lock();
startupDesktop(1);
@@ -1338,12 +1334,11 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
// wait broker process finish
waitpid(-1, &status, WUNTRACED);
- return Application::EXIT_OK;
-}
+ // remove child root
+ if (LOOLWSD::_childId > 0)
+ File(LOOLWSD::childRoot + Path::separator() + std::to_string(LOOLWSD::_childId)).remove(true);
-bool LOOLWSD::childMode() const
-{
- return _childId != 0;
+ return Application::EXIT_OK;
}
POCO_SERVER_MAIN(LOOLWSD)
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 342b36c..0970fc5 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -43,6 +43,7 @@ public:
static Poco::SharedMemory _sharedForkChild;
static Poco::NamedMutex _namedMutexLOOL;
static Poco::Random _rng;
+ static Poco::UInt64 _childId;
static const int DEFAULT_CLIENT_PORT_NUMBER = 9980;
static const int MASTER_PORT_NUMBER = 9981;
@@ -65,7 +66,6 @@ protected:
private:
void displayHelp();
- bool childMode() const;
void componentMain();
void desktopMain();
void startupComponent(int nComponents);
@@ -73,7 +73,6 @@ private:
int createComponent();
int createDesktop();
- Poco::UInt64 _childId;
static int _numPreSpawnedChildren;
static std::mutex _rngMutex;
More information about the Libreoffice-commits
mailing list