[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp loolwsd/DocumentBroker.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Oct 23 21:11:37 UTC 2016
loolwsd/DocumentBroker.cpp | 3 ++-
loolwsd/DocumentBroker.hpp | 16 ++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
New commits:
commit f0c3365f9f0ea454eccb9d26fd5ffcbdec3b2a19
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Oct 22 19:10:07 2016 -0400
loolwsd: improve ChildProcess cleanup
Change-Id: I9852f04021097800d5ab0ce775f26fada5f3c8e7
Reviewed-on: https://gerrit.libreoffice.org/30207
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index e64dfff..850d570 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -60,8 +60,9 @@ void ChildProcess::socketProcessor()
// Notify the broker that we're done.
auto docBroker = _docBroker.lock();
- if (docBroker)
+ if (docBroker && !_stop)
{
+ // No need to notify if asked to stop.
docBroker->childSocketTerminated();
}
}
diff --git a/loolwsd/DocumentBroker.hpp b/loolwsd/DocumentBroker.hpp
index 170613c..39bc19a 100644
--- a/loolwsd/DocumentBroker.hpp
+++ b/loolwsd/DocumentBroker.hpp
@@ -55,11 +55,8 @@ public:
~ChildProcess()
{
- if (_pid > 0)
- {
- Log::info("~ChildProcess dtor [" + std::to_string(_pid) + "].");
- close(false);
- }
+ Log::debug("~ChildProcess dtor [" + std::to_string(_pid) + "].");
+ close(true);
}
void setDocumentBroker(const std::shared_ptr<DocumentBroker>& docBroker)
@@ -68,11 +65,18 @@ public:
_docBroker = docBroker;
}
+ void stop()
+ {
+ Log::debug("Stopping ChildProcess [" + std::to_string(_pid) + "]");
+ _stop = true;
+ }
+
void close(const bool rude)
{
try
{
- _stop = true;
+ Log::debug("Closing ChildProcess [" + std::to_string(_pid) + "].");
+ stop();
IoUtil::shutdownWebSocket(_ws);
if (_thread.joinable())
{
More information about the Libreoffice-commits
mailing list