loolwsd/Admin.hpp | 2 -- loolwsd/Common.hpp | 3 ++- loolwsd/LOOLBroker.cpp | 35 ++++++++++++++++++++--------------- loolwsd/LOOLSession.hpp | 4 ---- loolwsd/LOOLWSD.cpp | 12 +++++------- 5 files changed, 27 insertions(+), 29 deletions(-)
New commits: commit 9ec0ae58a4ec013d41c9981b906257f5edfe6fc3 Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 09:45:21 2016 +0300 These can be static diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 5a44111..27483d6 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -54,8 +54,8 @@ typedef int (LokHookPreInit) (const char *install_path, const char *user_profile_path); -const std::string BROKER_SUFIX = ".fifo"; -const std::string BROKER_PREFIX = "lokit"; +static const std::string BROKER_SUFIX = ".fifo"; +static const std::string BROKER_PREFIX = "lokit"; static int WriterNotify = -1; static int ReaderBroker = -1; commit 957788a6e132153b5df8a230afc3843263013faa Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 09:43:29 2016 +0300 Define FIFO_ADMIN_NOTIFY in only one place diff --git a/loolwsd/Admin.hpp b/loolwsd/Admin.hpp index 6a91a10..5eef223 100644 --- a/loolwsd/Admin.hpp +++ b/loolwsd/Admin.hpp @@ -20,8 +20,6 @@ #include "AdminModel.hpp" -const std::string FIFO_ADMIN_NOTIFY = "lool_admin_notify.fifo"; - class Admin; class AdminRequestHandler: public Poco::Net::HTTPRequestHandler diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp index f14f5b6..89e780b 100644 --- a/loolwsd/Common.hpp +++ b/loolwsd/Common.hpp @@ -33,11 +33,12 @@ constexpr int READ_BUFFER_SIZE = 2048; /// size are considered small messages. constexpr int SMALL_MESSAGE_SIZE = READ_BUFFER_SIZE / 2; -constexpr auto NEW_CHILD_URI = "/loolws/newchild?"; constexpr auto CHILD_URI = "/loolws/child?"; +constexpr auto FIFO_ADMIN_NOTIFY = "lool_admin_notify.fifo"; constexpr auto FIFO_LOOLWSD = "loolwsdfifo"; constexpr auto FIFO_PATH = "pipe"; constexpr auto JAILED_DOCUMENT_ROOT = "/user/docs/"; +constexpr auto NEW_CHILD_URI = "/loolws/newchild?"; constexpr auto SSL_KEY_FILE = "key.pem"; #endif diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 660516e..5a44111 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -56,7 +56,6 @@ typedef int (LokHookPreInit) (const char *install_path, const char *user_profil const std::string BROKER_SUFIX = ".fifo"; const std::string BROKER_PREFIX = "lokit"; -const std::string FIFO_ADMIN_NOTIFY = "lool_admin_notify.fifo"; static int WriterNotify = -1; static int ReaderBroker = -1; @@ -905,7 +904,7 @@ static void lokit_main(const std::string& childRoot, const std::string pipeNotify = Path(pipePath, FIFO_ADMIN_NOTIFY).toString(); if ((WriterNotify = open(pipeNotify.c_str(), O_WRONLY) ) < 0) { - Log::error("Error: failed to open notify pipe [" + FIFO_ADMIN_NOTIFY + "] for writing."); + Log::error("Error: failed to open notify pipe [" + std::string(FIFO_ADMIN_NOTIFY) + "] for writing."); exit(Application::EXIT_SOFTWARE); } } @@ -1276,7 +1275,7 @@ void setupPipes(const std::string &childRoot) const std::string pipeNotify = Path(pipePath, FIFO_ADMIN_NOTIFY).toString(); if ((WriterNotify = open(pipeNotify.c_str(), O_WRONLY) ) < 0) { - Log::error("Error: failed to open notify pipe [" + FIFO_ADMIN_NOTIFY + "] for writing."); + Log::error("Error: failed to open notify pipe [" + std::string(FIFO_ADMIN_NOTIFY) + "] for writing."); exit(Application::EXIT_SOFTWARE); } } diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 545b16f..6f28356 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -1233,7 +1233,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) const std::string pipeNotify = Path(pipePath, FIFO_ADMIN_NOTIFY).toString(); if (mkfifo(pipeNotify.c_str(), 0666) < 0 && errno != EEXIST) { - Log::error("Error: Failed to create pipe FIFO [" + FIFO_ADMIN_NOTIFY + "]."); + Log::error("Error: Failed to create pipe FIFO [" + std::string(FIFO_ADMIN_NOTIFY) + "]."); exit(Application::EXIT_SOFTWARE); } @@ -1245,14 +1245,14 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) if ((pipeFlags = fcntl(notifyPipe, F_GETFL, 0)) < 0) { - Log::error("Error: failed to get pipe flags [" + FIFO_ADMIN_NOTIFY + "]."); + Log::error("Error: failed to get pipe flags [" + std::string(FIFO_ADMIN_NOTIFY) + "]."); exit(Application::EXIT_SOFTWARE); } pipeFlags &= ~O_NONBLOCK; if (fcntl(notifyPipe, F_SETFL, pipeFlags) < 0) { - Log::error("Error: failed to set pipe flags [" + FIFO_ADMIN_NOTIFY + "]."); + Log::error("Error: failed to set pipe flags [" + std::string(FIFO_ADMIN_NOTIFY) + "]."); exit(Application::EXIT_SOFTWARE); } commit 01be515760096b6dd5f484d637566c0a9d5ef0fe Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 09:36:27 2016 +0300 Include only what you use diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index b63d1a4..545b16f 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -45,12 +45,11 @@ DEALINGS IN THE SOFTWARE. #include <unistd.h> #include <sys/types.h> -#include <sys/wait.h> #include <sys/prctl.h> +#include <sys/stat.h> +#include <sys/wait.h> -#include <ftw.h> #include <time.h> -#include <utime.h> #include <cassert> #include <cstdlib> @@ -59,7 +58,6 @@ DEALINGS IN THE SOFTWARE. #include <map> #include <mutex> #include <sstream> -#include <unordered_set> #include <Poco/DOM/AutoPtr.h> #include <Poco/DOM/DOMParser.h> commit b6419ee915d6d663ebeb47c55f4ad202a966e747 Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 09:31:52 2016 +0300 Include only what you use diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp index 33f9d34..d5fd76b 100644 --- a/loolwsd/LOOLSession.hpp +++ b/loolwsd/LOOLSession.hpp @@ -11,18 +11,14 @@ #define INCLUDED_LOOLSESSION_HPP #include <cassert> -#include <condition_variable> -#include <map> #include <memory> #include <mutex> #include <ostream> -#include <set> #include <Poco/Net/WebSocket.h> #include <Poco/Buffer.h> #include <Poco/Path.h> #include <Poco/Process.h> -#include <Poco/Random.h> #include <Poco/StringTokenizer.h> #include <Poco/Types.h> commit c2370c56efb36939f9c554afcc330553737cf7a8 Author: Tor Lillqvist <t...@collabora.com> Date: Mon Apr 4 09:31:03 2016 +0300 Use 'using' consistenly diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index e0fa29a..660516e 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -67,7 +67,11 @@ static int NumPreSpawnedChildren = 1; using namespace LOOLProtocol; +using Poco::Exception; using Poco::File; +using Poco::Net::NetException; +using Poco::Net::HTTPClientSession; +using Poco::Net::HTTPResponse; using Poco::Net::HTTPRequest; using Poco::Net::WebSocket; using Poco::Path; @@ -75,7 +79,9 @@ using Poco::Process; using Poco::Runnable; using Poco::StringTokenizer; using Poco::Thread; +using Poco::Timestamp; using Poco::Util::Application; +using Poco::URI; namespace { @@ -305,7 +311,7 @@ public: _session->disconnect(); } - catch (const Poco::Exception& exc) + catch (const Exception& exc) { Log::error() << "Connection::run: Exception: " << exc.displayText() << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "") @@ -393,7 +399,7 @@ public: } } } - catch(Poco::Net::NetException& exc) + catch(NetException& exc) { Log::error() << "Document::~Document: " << exc.displayText() << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "") @@ -450,10 +456,10 @@ public: // Open websocket connection between the child process and the // parent. The parent forwards us requests that it can't handle (i.e most). - Poco::Net::HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER); + HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER); cs.setTimeout(0); HTTPRequest request(HTTPRequest::HTTP_GET, std::string(CHILD_URI) + "sessionId=" + sessionId + "&jailId=" + _jailId + "&docKey=" + _docKey); - Poco::Net::HTTPResponse response; + HTTPResponse response; auto ws = std::make_shared<WebSocket>(cs, request, response); ws->setReceiveTimeout(0); @@ -924,7 +930,7 @@ static void lokit_main(const std::string& childRoot, if (symlink(symlinkTarget.c_str(), symlinkSource.toString().c_str()) == -1) { Log::error("Error: symlink(\"" + symlinkTarget + "\",\"" + symlinkSource.toString() + "\") failed"); - throw Poco::Exception("symlink() failed"); + throw Exception("symlink() failed"); } Path jailLOInstallation(jailPath, loSubPath); @@ -1009,10 +1015,10 @@ static void lokit_main(const std::string& childRoot, Log::info("loolkit [" + std::to_string(Process::id()) + "] is ready."); // Open websocket connection between the child process and WSD. - Poco::Net::HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER); + HTTPClientSession cs("127.0.0.1", MASTER_PORT_NUMBER); cs.setTimeout(0); HTTPRequest request(HTTPRequest::HTTP_GET, std::string(NEW_CHILD_URI) + "pid=" + pid); - Poco::Net::HTTPResponse response; + HTTPResponse response; auto ws = std::make_shared<WebSocket>(cs, request, response); ws->setReceiveTimeout(0); @@ -1036,7 +1042,7 @@ static void lokit_main(const std::string& childRoot, const std::string& docKey = tokens[2]; std::string url; - Poco::URI::decode(docKey, url); + URI::decode(docKey, url); Log::info("New session [" + sessionId + "] request on url [" + url + "]."); if (!document) @@ -1074,7 +1080,7 @@ static void lokit_main(const std::string& childRoot, [](){ return TerminationFlag; }, socketName); } - catch (const Poco::Exception& exc) + catch (const Exception& exc) { Log::error() << exc.name() << ": " << exc.displayText() << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "") @@ -1367,7 +1373,7 @@ int main(int argc, char** argv) ChildDispatcher childDispatcher; Log::info("loolbroker is ready."); - Poco::Timestamp startTime; + Timestamp startTime; while (!TerminationFlag) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits