[Libreoffice-commits] online.git: loolwsd/LOOLBroker.cpp loolwsd/LOOLKit.cpp loolwsd/MasterProcessSession.cpp loolwsd/Util.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Jan 21 07:43:29 PST 2016
loolwsd/LOOLBroker.cpp | 6 ++----
loolwsd/LOOLKit.cpp | 2 +-
loolwsd/MasterProcessSession.cpp | 4 ++--
loolwsd/Util.hpp | 7 ++++++-
4 files changed, 11 insertions(+), 8 deletions(-)
New commits:
commit ad7509d449b55df250572ad3b3b8d2b2156c6865
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Tue Jan 19 19:31:06 2016 -0500
loolwsd: writeFIFO overload to take std::string
Change-Id: Ibfac97d1d4f101a10bd0f696b8b89a22170b1b11
Reviewed-on: https://gerrit.libreoffice.org/21672
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index eefa8e9..1084c80 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -262,9 +262,7 @@ public:
ssize_t sendMessage(int nPipeWriter, const std::string& aMessage)
{
- ssize_t nBytes = -1;
-
- nBytes = Util::writeFIFO(nPipeWriter, aMessage.c_str(), aMessage.length());
+ const ssize_t nBytes = Util::writeFIFO(nPipeWriter, aMessage);
if ( nBytes < 0 )
Log::error("Error writting to child pipe.");
@@ -317,7 +315,7 @@ public:
assert(it.first > 0 && it.second > 0);
Log::trace("Query to kit [" + std::to_string(it.first) + "]: " + aMessage);
- ssize_t nBytes = Util::writeFIFO(it.second, aMessage.c_str(), aMessage.length());
+ ssize_t nBytes = Util::writeFIFO(it.second, aMessage);
if ( nBytes < 0 )
{
Log::error("Error writting to child pipe: " + std::to_string(it.first) + ". Clearing cache.");
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 1cce089..a010383 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -901,7 +901,7 @@ void lokit_main(const std::string &loSubPath, const std::string& jailId, const s
}
Log::trace("Send: " + aResponse);
- Util::writeFIFO(writerBroker, aResponse.c_str(), aResponse.length());
+ Util::writeFIFO(writerBroker, aResponse);
aMessage.clear();
}
}
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index d41820d..aebb477 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -406,7 +406,7 @@ bool MasterProcessSession::loadDocument(const char* /*buffer*/, int /*length*/,
// request new URL session
const std::string aMessage = "request " + getId() + " " + _docURL + "\r\n";
Log::debug("Sending to Broker: " + aMessage);
- Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage.c_str(), aMessage.length());
+ Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage);
}
catch (const Poco::SyntaxException&)
{
@@ -718,7 +718,7 @@ void MasterProcessSession::dispatchChild()
Log::info() << "Retrying child permission... " << nRequest << Log::end;
// request again new URL session
const std::string aMessage = "request " + getId() + " " + _docURL + "\r\n";
- Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage.c_str(), aMessage.length());
+ Util::writeFIFO(LOOLWSD::BrokerWritePipe, aMessage);
}
}
diff --git a/loolwsd/Util.hpp b/loolwsd/Util.hpp
index a38541b..1e50562 100644
--- a/loolwsd/Util.hpp
+++ b/loolwsd/Util.hpp
@@ -59,7 +59,12 @@ namespace Util
// Call WebSocket::shutdown() ignoring Poco::IOException
void shutdownWebSocket(Poco::Net::WebSocket& ws);
- ssize_t writeFIFO(int nPipe, const char* pBuffer, ssize_t nSize);
+ ssize_t writeFIFO(const int nPipe, const char* pBuffer, ssize_t nSize);
+ inline
+ ssize_t writeFIFO(const int nPipe, const std::string& message)
+ {
+ return writeFIFO(nPipe, message.c_str(), message.size());
+ }
ssize_t readFIFO(int nPipe, char* pBuffer, ssize_t nSize);
More information about the Libreoffice-commits
mailing list