[Libreoffice-commits] online.git: kit/Kit.cpp wsd/ClientSession.cpp wsd/ClientSession.hpp wsd/DocumentBroker.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Feb 9 04:28:45 UTC 2017
kit/Kit.cpp | 15 ++-------------
wsd/ClientSession.cpp | 1 -
wsd/ClientSession.hpp | 2 +-
wsd/DocumentBroker.cpp | 25 +++++++++++++++++++++----
4 files changed, 24 insertions(+), 19 deletions(-)
New commits:
commit 404111877a01bbc9f884a1db4cd582249154fe35
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Mon Feb 6 20:10:08 2017 -0500
wsd: broadcast client messages from WSD not from the Kit
Change-Id: I9c179a2f41a0aaeef35b84208be8ab91af9ee53a
Reviewed-on: https://gerrit.libreoffice.org/34051
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 4ab1da3..fbbb030 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1072,19 +1072,8 @@ private:
oss << "]";
const auto msg = oss.str();
- std::unique_lock<std::mutex> lock(_mutex);
-
- // Broadcast updated viewinfo to all _active_ connections.
- // These are internal sockets, so unless WSD is chocked,
- // no need to send on separate thread.
- for (const auto& pair : _sessions)
- {
- const auto& session = pair.second;
- if (!session->isCloseFrame() && session->isActive())
- {
- session->sendTextFrame(msg);
- }
- }
+ // Broadcast updated viewinfo to all clients.
+ sendTextFrame("client-all " + msg);
}
private:
diff --git a/wsd/ClientSession.cpp b/wsd/ClientSession.cpp
index f8079cb..deb4680 100644
--- a/wsd/ClientSession.cpp
+++ b/wsd/ClientSession.cpp
@@ -676,7 +676,6 @@ bool ClientSession::forwardToClient(const std::shared_ptr<Message>& payload)
return true;
}
- LOG_TRC(getName() << " enqueue to client: " << message);
enqueueSendMessage(payload);
return true;
diff --git a/wsd/ClientSession.hpp b/wsd/ClientSession.hpp
index 17c5c0d..a6efb50 100644
--- a/wsd/ClientSession.hpp
+++ b/wsd/ClientSession.hpp
@@ -72,7 +72,7 @@ public:
}
else
{
- LOG_TRC(getName() << " enqueueing client message: " << data->abbr());
+ LOG_TRC(getName() << " enqueueing client message " << data->id());
_senderQueue.enqueue(data);
}
}
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 2cda4a0..fe3ea89 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1037,16 +1037,33 @@ bool DocumentBroker::forwardToClient(const std::shared_ptr<Message>& payload)
std::string sid;
if (LOOLProtocol::parseNameValuePair(payload->forwardToken(), name, sid, '-') && name == "client")
{
+ const auto& data = payload->data().data();
+ const auto& size = payload->size();
+
std::unique_lock<std::mutex> lock(_mutex);
- const auto it = _sessions.find(sid);
- if (it != _sessions.end())
+ if (sid == "all")
{
- return it->second->handleKitToClientMessage(payload->data().data(), payload->size());
+ // Broadcast to all.
+ for (const auto& pair : _sessions)
+ {
+ if (!pair.second->isHeadless() && !pair.second->isCloseFrame())
+ {
+ pair.second->handleKitToClientMessage(data, size);
+ }
+ }
}
else
{
- LOG_WRN("Client session [" << sid << "] not found to forward message: " << msg);
+ const auto it = _sessions.find(sid);
+ if (it != _sessions.end())
+ {
+ return it->second->handleKitToClientMessage(data, size);
+ }
+ else
+ {
+ LOG_WRN("Client session [" << sid << "] not found to forward message: " << msg);
+ }
}
}
else
More information about the Libreoffice-commits
mailing list