summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2015-06-09 18:22:09 +0300
committerTor Lillqvist <tml@collabora.com>2015-06-09 18:22:09 +0300
commit12e0a346ca0e1ae11b5473394e506e7df20a9457 (patch)
treef470f8558ba53ac937bcf1060ce06f0ed44537bb
parentUse a queue also in the child processes (diff)
downloadonline-private/tml/cancellation.tar.gz
online-private/tml/cancellation.zip
Don't bother with storing a ref to Application::instance() in a variable in some places private/tml/cancellation
-rw-r--r--loolwsd/LOOLSession.cpp4
-rw-r--r--loolwsd/LOOLWSD.cpp12
-rw-r--r--loolwsd/LoadTest.cpp3
3 files changed, 6 insertions, 13 deletions
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 9da62444b7..2b2d9bb04a 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -663,12 +663,10 @@ ChildProcessSession::~ChildProcessSession()
bool ChildProcessSession::handleInput(const char *buffer, int length)
{
- Application& app = Application::instance();
-
std::string firstLine = getFirstLine(buffer, length);
StringTokenizer tokens(firstLine, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
- app.logger().information(Util::logPrefix() + "Input: " + getAbbreviatedMessage(buffer, length));
+ Application::instance().logger().information(Util::logPrefix() + "Input: " + getAbbreviatedMessage(buffer, length));
if (tokens[0] == "load")
{
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 7bbe69c8e5..f6546123fd 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -169,8 +169,6 @@ public:
return;
}
- Application& app = Application::instance();
-
tsqueue<std::string> queue;
Thread queueHandlerThread;
QueueHandler handler(queue);
@@ -258,7 +256,7 @@ public:
}
catch (WebSocketException& exc)
{
- app.logger().error(Util::logPrefix() + "WebSocketException: " + exc.message());
+ Application::instance().logger().error(Util::logPrefix() + "WebSocketException: " + exc.message());
switch (exc.code())
{
case WebSocket::WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION:
@@ -276,7 +274,7 @@ public:
}
catch (IOException& exc)
{
- app.logger().error(Util::logPrefix() + "IOException: " + exc.message());
+ Application::instance().logger().error(Util::logPrefix() + "IOException: " + exc.message());
}
queue.clear();
queue.put("eof");
@@ -293,7 +291,6 @@ public:
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) override
{
- Application& app = Application::instance();
std::string line = (Util::logPrefix() + "Request from " +
request.clientAddress().toString() + ": " +
request.getMethod() + " " +
@@ -305,7 +302,7 @@ public:
line += " / " + it->first + ": " + it->second;
}
- app.logger().information(line);
+ Application::instance().logger().information(line);
return new WebSocketRequestHandler();
}
};
@@ -322,7 +319,6 @@ public:
{
int flags;
int n;
- Application& app = Application::instance();
_ws.setReceiveTimeout(0);
try
{
@@ -343,7 +339,7 @@ public:
}
catch (WebSocketException& exc)
{
- app.logger().error(Util::logPrefix() + "WebSocketException: " + exc.message());
+ Application::instance().logger().error(Util::logPrefix() + "WebSocketException: " + exc.message());
_ws.close();
}
}
diff --git a/loolwsd/LoadTest.cpp b/loolwsd/LoadTest.cpp
index c03d581704..b146ed2d44 100644
--- a/loolwsd/LoadTest.cpp
+++ b/loolwsd/LoadTest.cpp
@@ -86,7 +86,6 @@ public:
int flags;
int n;
int tileCount = 0;
- Application& app = Application::instance();
try
{
do
@@ -135,7 +134,7 @@ public:
}
catch (WebSocketException& exc)
{
- app.logger().error("WebSocketException: " + exc.message());
+ Application::instance().logger().error("WebSocketException: " + exc.message());
_ws.close();
}
std::cout << Util::logPrefix() << "Got " << tileCount << " tiles" << std::endl;