[Libreoffice-commits] online.git: common/Session.cpp net/Socket.hpp net/WebSocketHandler.hpp wsd/DocumentBroker.cpp wsd/LOOLWSD.cpp
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 16 10:55:38 UTC 2020
common/Session.cpp | 2 +-
net/Socket.hpp | 4 ++--
net/WebSocketHandler.hpp | 6 +++---
wsd/DocumentBroker.cpp | 2 +-
wsd/LOOLWSD.cpp | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
New commits:
commit cd42700054646d6f9c2bc89769fb9e05f829776c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Mar 16 10:34:12 2020 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Mar 16 11:55:19 2020 +0100
Rework the somewhat odd sendTextMessage() interface
It took both an std::string and a length. Take a char* and a length
instead.
Change-Id: Id37dfa67fe1baae09b69819680848a0a8a1d80ed
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90552
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/common/Session.cpp b/common/Session.cpp
index 15dbe86d7..d24b615a9 100644
--- a/common/Session.cpp
+++ b/common/Session.cpp
@@ -221,7 +221,7 @@ void Session::shutdown(bool goingAway, const std::string& statusMessage)
{
// skip the queue; FIXME: should we flush SessionClient's queue ?
std::string closeMsg = "close: " + statusMessage;
- _protocol->sendTextMessage(closeMsg, closeMsg.size());
+ _protocol->sendTextMessage(closeMsg.c_str(), closeMsg.size());
_protocol->shutdown(goingAway, statusMessage);
}
}
diff --git a/net/Socket.hpp b/net/Socket.hpp
index 1e632516e..a6395b9b4 100644
--- a/net/Socket.hpp
+++ b/net/Socket.hpp
@@ -395,7 +395,7 @@ public:
/// Clear all external references
virtual void dispose() { _msgHandler.reset(); }
- virtual int sendTextMessage(const std::string &msg, const size_t len, bool flush = false) const = 0;
+ virtual int sendTextMessage(const char* msg, const size_t len, bool flush = false) const = 0;
virtual int sendBinaryMessage(const char *data, const size_t len, bool flush = false) const = 0;
virtual void shutdown(bool goingAway = false, const std::string &statusMessage = "") = 0;
@@ -410,7 +410,7 @@ class SimpleSocketHandler : public ProtocolHandlerInterface
{
public:
SimpleSocketHandler() {}
- int sendTextMessage(const std::string &, const size_t, bool) const override { return 0; }
+ int sendTextMessage(const char*, const size_t, bool) const override { return 0; }
int sendBinaryMessage(const char *, const size_t , bool ) const override { return 0; }
void shutdown(bool, const std::string &) override {}
void getIOStats(uint64_t &, uint64_t &) override {}
diff --git a/net/WebSocketHandler.hpp b/net/WebSocketHandler.hpp
index 3a01fea17..43d710ea4 100644
--- a/net/WebSocketHandler.hpp
+++ b/net/WebSocketHandler.hpp
@@ -519,13 +519,13 @@ public:
/// Sends a WebSocket Text message.
int sendMessage(const std::string& msg) const
{
- return sendTextMessage(msg, msg.size());
+ return sendTextMessage(msg.c_str(), msg.size());
}
/// Implementation of the ProtocolHandlerInterface.
- int sendTextMessage(const std::string &msg, const size_t len, bool flush = false) const override
+ int sendTextMessage(const char* msg, const size_t len, bool flush = false) const override
{
- return sendMessage(msg.data(), len, WSOpCode::Text, flush);
+ return sendMessage(msg, len, WSOpCode::Text, flush);
}
/// Implementation of the ProtocolHandlerInterface.
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 8b0c883c0..8c229fd18 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -1512,7 +1512,7 @@ std::shared_ptr<ClientSession> DocumentBroker::createNewClientSession(
{
const std::string statusReady = "statusindicator: ready";
LOG_TRC("Sending to Client [" << statusReady << "].");
- ws->sendTextMessage(statusReady, statusReady.size());
+ ws->sendTextMessage(statusReady.c_str(), statusReady.size());
}
// In case of WOPI, if this session is not set as readonly, it might be set so
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index a06687788..ecceaca34 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1763,7 +1763,7 @@ static std::shared_ptr<DocumentBroker>
{
LOG_WRN("DocBroker with docKey [" << docKey << "] that is marked to be destroyed. Rejecting client request.");
std::string msg("error: cmd=load kind=docunloading");
- proto->sendTextMessage(msg, msg.size());
+ proto->sendTextMessage(msg.data(), msg.size());
proto->shutdown(true, "error: cmd=load kind=docunloading");
return nullptr;
}
@@ -1782,7 +1782,7 @@ static std::shared_ptr<DocumentBroker>
// Indicate to the client that we're connecting to the docbroker.
const std::string statusConnect = "statusindicator: connect";
LOG_TRC("Sending to Client [" << statusConnect << "].");
- proto->sendTextMessage(statusConnect, statusConnect.size());
+ proto->sendTextMessage(statusConnect.data(), statusConnect.size());
if (!docBroker)
{
More information about the Libreoffice-commits
mailing list