[Libreoffice-commits] online.git: loolwsd/LOOLSession.cpp loolwsd/LOOLSession.hpp loolwsd/MasterProcessSession.cpp
Henry Castro
hcastro at collabora.com
Mon Dec 28 13:05:38 PST 2015
loolwsd/LOOLSession.cpp | 3 ++-
loolwsd/LOOLSession.hpp | 3 +++
loolwsd/MasterProcessSession.cpp | 4 ++++
3 files changed, 9 insertions(+), 1 deletion(-)
New commits:
commit 7fc04b6e71a3666a059d3db85f655d515d49bf56
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Dec 28 17:05:01 2015 -0400
loolwsd: stop dispatch child when closed websocket prison
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 7538931..52bb451 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -89,7 +89,8 @@ LOOLSession::LOOLSession(const std::string& id, const Kind kind,
_kindString(kind == Kind::ToClient ? "ToClient" :
kind == Kind::ToMaster ? "ToMaster" : "ToPrisoner"),
_ws(ws),
- _docURL("")
+ _docURL(""),
+ _bShutdown(false)
{
setId(id);
}
diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp
index 85221ed..22a308f 100644
--- a/loolwsd/LOOLSession.hpp
+++ b/loolwsd/LOOLSession.hpp
@@ -97,6 +97,9 @@ protected:
/// Document options: a JSON string, containing options (rendering, also possibly load in the future).
std::string _docOptions;
+ // Flag to stop dispatch chid messages when websocket is shutting down
+ bool _bShutdown;
+
private:
virtual bool _handleInput(const char *buffer, int length) = 0;
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 5f00812..5537ca6 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -72,6 +72,7 @@ MasterProcessSession::~MasterProcessSession()
else
if (_kind == Kind::ToPrisoner && peer)
{
+ peer->_bShutdown = true;
Util::shutdownWebSocket(*(peer->_ws));
}
}
@@ -559,6 +560,9 @@ void MasterProcessSession::dispatchChild()
short nRequest = 3;
bool bFound = false;
+ if (_bShutdown)
+ return;
+
// Wait until the child has connected with Master.
std::shared_ptr<MasterProcessSession> childSession;
std::unique_lock<std::mutex> lock(_availableChildSessionMutex);
More information about the Libreoffice-commits
mailing list