[Libreoffice-commits] online.git: wsd/ClientSession.cpp wsd/LOOLWSD.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun Mar 26 05:12:30 UTC 2017
wsd/ClientSession.cpp | 6 +++---
wsd/LOOLWSD.cpp | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 1c5896f302befd2cede6098148d676cd678b91cf
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Mar 26 00:50:51 2017 -0400
wsd: count connections symmetrically
ClientSession::onDisconnect might not always be
called. The disymmetry between incrementing in
the ctor and decrementing in onDisconnect always
ran the risk of mismatch and leaking connection
counts, eventually blocking new clients.
Change-Id: I39ec65016984c0cddd0e16cfbf201049ced53713
Reviewed-on: https://gerrit.libreoffice.org/35713
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index fbc50b98..40d78f1d 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -47,7 +47,8 @@ ClientSession::ClientSession(const std::string& id,
ClientSession::~ClientSession()
{
- LOG_INF("~ClientSession dtor [" << getName() << "].");
+ const size_t curConnections = --LOOLWSD::NumConnections;
+ LOG_INF("~ClientSession dtor [" << getName() << "], current number of connections: " << curConnections);
stop();
}
@@ -726,8 +727,7 @@ bool ClientSession::forwardToClient(const std::shared_ptr<Message>& payload)
void ClientSession::onDisconnect()
{
- const size_t curConnections = --LOOLWSD::NumConnections;
- LOG_INF(getName() << " Disconnected, current # of connections: " << curConnections);
+ LOG_INF(getName() << " Disconnected, current number of connections: " << LOOLWSD::NumConnections);
const auto docBroker = getDocumentBroker();
LOG_CHECK_RET(docBroker && "Null DocumentBroker instance", );
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index eaa02fcb..df3382a0 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1285,7 +1285,7 @@ static std::shared_ptr<DocumentBroker> findOrCreateDocBroker(WebSocketHandler& w
static_assert(MAX_DOCUMENTS > 0, "MAX_DOCUMENTS must be positive");
if (DocBrokers.size() + 1 > MAX_DOCUMENTS)
{
- LOG_ERR("Maximum number of open documents reached.");
+ LOG_ERR("Maximum number of open documents of " << MAX_DOCUMENTS << " reached.");
shutdownLimitReached(ws);
return nullptr;
}
More information about the Libreoffice-commits
mailing list