[Libreoffice-commits] online.git: loolwsd/ClientSession.cpp loolwsd/ClientSession.hpp loolwsd/LOOLSession.hpp loolwsd/PrisonerSession.cpp loolwsd/PrisonerSession.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sat May 21 03:30:10 UTC 2016
loolwsd/ClientSession.cpp | 23 +++++++++--------------
loolwsd/ClientSession.hpp | 2 --
loolwsd/LOOLSession.hpp | 6 +++---
loolwsd/PrisonerSession.cpp | 13 ++++---------
loolwsd/PrisonerSession.hpp | 2 --
5 files changed, 16 insertions(+), 30 deletions(-)
New commits:
commit 3cc295b7d2108ad20c659998c22f5f45a352f86e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Fri May 20 19:02:44 2016 -0400
loolwsd: remove thin wrapper
Change-Id: Id84a404aecd7f553665e65c1959dcca45309199e
Reviewed-on: https://gerrit.libreoffice.org/25240
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/ClientSession.cpp b/loolwsd/ClientSession.cpp
index c951181..2a57e46 100644
--- a/loolwsd/ClientSession.cpp
+++ b/loolwsd/ClientSession.cpp
@@ -132,7 +132,7 @@ bool ClientSession::_handleInput(const char *buffer, int length)
else if (tokens[0] == "canceltiles")
{
if (!_peer.expired())
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
}
else if (tokens[0] == "commandvalues")
{
@@ -174,11 +174,11 @@ bool ClientSession::_handleInput(const char *buffer, int length)
tokens[0] != "userinactive" && tokens[0] != "useractive")
{
std::string dummyFrame = "dummymsg";
- forwardToPeer(dummyFrame.c_str(), dummyFrame.size());
+ forwardToPeer(_peer, dummyFrame.c_str(), dummyFrame.size());
}
else if (tokens[0] != "requestloksession")
{
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
}
}
return true;
@@ -213,7 +213,7 @@ bool ClientSession::loadDocument(const char* /*buffer*/, int /*length*/, StringT
oss << " options=" << _docOptions;
const auto loadRequest = oss.str();
- forwardToPeer(loadRequest.c_str(), loadRequest.size());
+ forwardToPeer(_peer, loadRequest.c_str(), loadRequest.size());
return true;
}
catch (const Poco::SyntaxException&)
@@ -239,7 +239,7 @@ bool ClientSession::getStatus(const char *buffer, int length)
return true;
}
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
return true;
}
@@ -250,7 +250,7 @@ void ClientSession::setEditLock(const bool value)
const auto msg = "editlock: " + std::to_string(isEditLocked());
const auto mv = std::getenv("LOK_VIEW_CALLBACK") ? "1" : "0";
Log::debug("Forwarding [" + msg + "] to set editlock to " + std::to_string(value) + ". MultiView: " + mv);
- forwardToPeer(msg.data(), msg.size());
+ forwardToPeer(_peer, msg.data(), msg.size());
}
bool ClientSession::getCommandValues(const char *buffer, int length, StringTokenizer& tokens)
@@ -269,7 +269,7 @@ bool ClientSession::getCommandValues(const char *buffer, int length, StringToken
return true;
}
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
return true;
}
@@ -282,7 +282,7 @@ bool ClientSession::getPartPageRectangles(const char *buffer, int length)
return true;
}
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
return true;
}
@@ -317,7 +317,7 @@ void ClientSession::sendFontRendering(const char *buffer, int length, StringToke
return;
}
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
}
void ClientSession::sendTile(const char * /*buffer*/, int /*length*/, StringTokenizer& tokens)
@@ -407,11 +407,6 @@ void ClientSession::sendCombinedTiles(const char* /*buffer*/, int /*length*/, St
}
}
-void ClientSession::forwardToPeer(const char *buffer, int length)
-{
- LOOLSession::forwardToPeer(_peer, buffer, length);
-}
-
bool ClientSession::shutdownPeer(Poco::UInt16 statusCode, const std::string& message)
{
auto peer = _peer.lock();
diff --git a/loolwsd/ClientSession.hpp b/loolwsd/ClientSession.hpp
index 6bdac2b..e93c47e 100644
--- a/loolwsd/ClientSession.hpp
+++ b/loolwsd/ClientSession.hpp
@@ -76,8 +76,6 @@ private:
void sendCombinedTiles(const char *buffer, int length, Poco::StringTokenizer& tokens);
void sendFontRendering(const char *buffer, int length, Poco::StringTokenizer& tokens);
- void forwardToPeer(const char *buffer, int length);
-
private:
std::shared_ptr<DocumentBroker> _docBroker;
diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp
index 915fb53..35c4690 100644
--- a/loolwsd/LOOLSession.hpp
+++ b/loolwsd/LOOLSession.hpp
@@ -95,7 +95,7 @@ protected:
}
template <typename T>
- void forwardToPeer(T& p, const char *buffer, int length)
+ bool forwardToPeer(T& p, const char *buffer, int length)
{
const auto message = LOOLProtocol::getAbbreviatedMessage(buffer, length);
@@ -107,11 +107,11 @@ protected:
else if (peer->isCloseFrame())
{
Log::trace(getName() + ": peer began the closing handshake. Dropping forward message [" + message + "].");
- return;
+ return false;
}
Log::trace(getName() + " -> " + peer->getName() + ": " + message);
- peer->sendBinaryFrame(buffer, length);
+ return peer->sendBinaryFrame(buffer, length);
}
// Fields common to sessions in master and jailed processes:
diff --git a/loolwsd/PrisonerSession.cpp b/loolwsd/PrisonerSession.cpp
index bac4b6b..bca2b73 100644
--- a/loolwsd/PrisonerSession.cpp
+++ b/loolwsd/PrisonerSession.cpp
@@ -105,7 +105,7 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
errorKind == "passwordrequired:to-modify" ||
errorKind == "wrongpassword")
{
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
peer->setLoadFailed(errorKind);
return false;
}
@@ -169,13 +169,13 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
_docBroker->tileCache().saveTextFile(std::string(buffer, length), "status.txt");
// Forward the status response to the client.
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
// And let clients know if they hold the edit lock.
std::string message = "editlock: ";
message += std::to_string(peer->isEditLocked());
Log::debug("Forwarding [" + message + "] in response to status.");
- forwardToPeer(message.c_str(), message.size());
+ forwardToPeer(_peer, message.c_str(), message.size());
return true;
}
else if (tokens[0] == "commandvalues:")
@@ -219,15 +219,10 @@ bool PrisonerSession::_handleInput(const char *buffer, int length)
}
}
- forwardToPeer(buffer, length);
+ forwardToPeer(_peer, buffer, length);
return true;
}
-void PrisonerSession::forwardToPeer(const char *buffer, int length)
-{
- LOOLSession::forwardToPeer(_peer, buffer, length);
-}
-
bool PrisonerSession::shutdownPeer(Poco::UInt16 statusCode, const std::string& message)
{
auto peer = _peer.lock();
diff --git a/loolwsd/PrisonerSession.hpp b/loolwsd/PrisonerSession.hpp
index e351f2f..4be892e 100644
--- a/loolwsd/PrisonerSession.hpp
+++ b/loolwsd/PrisonerSession.hpp
@@ -31,8 +31,6 @@ private:
virtual bool _handleInput(const char *buffer, int length) override;
- void forwardToPeer(const char *buffer, int length);
-
private:
std::shared_ptr<DocumentBroker> _docBroker;
More information about the Libreoffice-commits
mailing list