loolwsd/Admin.cpp | 4 +- loolwsd/AdminModel.hpp | 3 -- loolwsd/Auth.hpp | 3 -- loolwsd/ChildProcessSession.cpp | 13 ++------- loolwsd/LOOLBroker.cpp | 20 ++------------ loolwsd/LOOLKit.cpp | 54 +++++++++++++-------------------------- loolwsd/LOOLSession.cpp | 7 ----- loolwsd/LOOLSession.hpp | 6 ---- loolwsd/LOOLWSD.cpp | 10 +------ loolwsd/LOOLWSD.hpp | 14 ++++------ loolwsd/MasterProcessSession.cpp | 5 --- loolwsd/MessageQueue.hpp | 2 - loolwsd/Util.cpp | 28 +++++++------------- 13 files changed, 50 insertions(+), 119 deletions(-)
New commits: commit e8a5ba1b29a54708ebbf0a066e57f5c681237e7b Author: Tor Lillqvist <[email protected]> Date: Tue Mar 8 09:45:23 2016 +0200 _bShutdown is always false diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp index 1ffeb21..b51120a 100644 --- a/loolwsd/LOOLSession.cpp +++ b/loolwsd/LOOLSession.cpp @@ -54,7 +54,6 @@ LOOLSession::LOOLSession(const std::string& id, const Kind kind, _isDocPasswordProvided(false), _isDocLoaded(false), _isDocPasswordProtected(false), - _bShutdown(false), _disconnected(false) { // Only a post request can have a null ws. diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp index 2fd660e..6a55c72 100644 --- a/loolwsd/LOOLSession.hpp +++ b/loolwsd/LOOLSession.hpp @@ -115,9 +115,6 @@ protected: /// Document options: a JSON string, containing options (rendering, also possibly load in the future). std::string _docOptions; - // Flag to stop dispatch chid messages when websocket is shutting down - bool _bShutdown; - private: virtual bool _handleInput(const char *buffer, int length) = 0; diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index 7c9d23b..92e2126 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -758,9 +758,6 @@ void MasterProcessSession::dispatchChild() int nRequest = 3; bool bFound = false; - if (_bShutdown) - return; - // Wait until the child has connected with Master. std::shared_ptr<MasterProcessSession> childSession; std::unique_lock<std::mutex> lock(AvailableChildSessionMutex); commit e7e1ef58ae8ae0a0bceebc40491c4a2c1db293df Author: Tor Lillqvist <[email protected]> Date: Tue Mar 8 09:31:29 2016 +0200 Cosmetics: Sort and prune #include and 'using' lines diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp index ff9c806..0f5937c 100644 --- a/loolwsd/Admin.cpp +++ b/loolwsd/Admin.cpp @@ -11,12 +11,12 @@ #include <sys/poll.h> #include <sys/prctl.h> -#include <Poco/Net/WebSocket.h> #include <Poco/Net/HTTPRequestHandler.h> #include <Poco/Net/HTTPServerParams.h> #include <Poco/Net/HTTPServerRequest.h> #include <Poco/Net/HTTPServerResponse.h> #include <Poco/Net/NetException.h> +#include <Poco/Net/WebSocket.h> #include <Poco/StringTokenizer.h> #include "Admin.hpp" @@ -34,10 +34,10 @@ using Poco::Net::HTTPServerParams; using Poco::Net::HTTPServerRequest; using Poco::Net::HTTPServerResponse; using Poco::Net::ServerSocket; +using Poco::Net::Socket; using Poco::Net::WebSocket; using Poco::Net::WebSocketException; using Poco::StringTokenizer; -using Poco::Net::Socket; /// Handle admin requests. class AdminRequestHandler: public HTTPRequestHandler diff --git a/loolwsd/AdminModel.hpp b/loolwsd/AdminModel.hpp index cb6561b..4e00446 100644 --- a/loolwsd/AdminModel.hpp +++ b/loolwsd/AdminModel.hpp @@ -10,8 +10,6 @@ #ifndef INCLUDED_ADMIN_MODEL_HPP #define INCLUDED_ADMIN_MODEL_HPP -#include "config.h" - #include <memory> #include <sstream> #include <string> @@ -338,4 +336,5 @@ private: }; #endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/loolwsd/Auth.hpp b/loolwsd/Auth.hpp index c968ece..f118505 100644 --- a/loolwsd/Auth.hpp +++ b/loolwsd/Auth.hpp @@ -105,7 +105,6 @@ private: const std::string _authVerifyUrl; }; - - #endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp index 51f6790..468eaa3 100644 --- a/loolwsd/ChildProcessSession.cpp +++ b/loolwsd/ChildProcessSession.cpp @@ -8,41 +8,36 @@ */ #include <sys/prctl.h> + #include <iostream> #include <Poco/Exception.h> -#include <Poco/File.h> #include <Poco/JSON/Object.h> #include <Poco/JSON/Parser.h> #include <Poco/Net/WebSocket.h> #include <Poco/Notification.h> #include <Poco/NotificationQueue.h> #include <Poco/Path.h> -#include <Poco/Process.h> #include <Poco/String.h> #include <Poco/StringTokenizer.h> #include <Poco/URI.h> -#include "Common.hpp" #include "ChildProcessSession.hpp" +#include "Common.hpp" #include "LOKitHelper.hpp" #include "LOOLProtocol.hpp" -#include "Util.hpp" #include "Rectangle.hpp" +#include "Util.hpp" using namespace LOOLProtocol; using Poco::Exception; -using Poco::File; -using Poco::IOException; using Poco::JSON::Object; using Poco::JSON::Parser; +using Poco::Net::WebSocket; using Poco::Notification; using Poco::NotificationQueue; -using Poco::Net::WebSocket; using Poco::Path; -using Poco::Process; -using Poco::ProcessHandle; using Poco::StringTokenizer; using Poco::URI; diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index dc204fc..9ac2dc8 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -26,46 +26,47 @@ #include <iostream> #include <memory> -#include <Poco/Net/WebSocket.h> +#include <Poco/Exception.h> +#include <Poco/Mutex.h> #include <Poco/Net/HTTPClientSession.h> #include <Poco/Net/HTTPRequest.h> #include <Poco/Net/HTTPResponse.h> -#include <Poco/Thread.h> -#include <Poco/ThreadLocal.h> +#include <Poco/Net/NetException.h> +#include <Poco/Net/WebSocket.h> +#include <Poco/Process.h> #include <Poco/Runnable.h> #include <Poco/StringTokenizer.h> -#include <Poco/Exception.h> -#include <Poco/Process.h> -#include <Poco/Mutex.h> -#include <Poco/Net/NetException.h> +#include <Poco/Thread.h> +#include <Poco/ThreadLocal.h> #include <Poco/Util/Application.h> #define LOK_USE_UNSTABLE_API #include <LibreOfficeKit/LibreOfficeKitInit.h> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include "Capabilities.hpp" +#include "ChildProcessSession.hpp" #include "Common.hpp" #include "LOKitHelper.hpp" +#include "LOOLProtocol.hpp" #include "QueueHandler.hpp" #include "Util.hpp" -#include "ChildProcessSession.hpp" -#include "LOOLProtocol.hpp" -#include "Capabilities.hpp" using namespace LOOLProtocol; -using Poco::Net::WebSocket; + +using Poco::Exception; +using Poco::File; using Poco::Net::HTTPClientSession; using Poco::Net::HTTPRequest; using Poco::Net::HTTPResponse; -using Poco::Thread; +using Poco::Net::WebSocket; +using Poco::Path; +using Poco::Process; using Poco::Runnable; using Poco::StringTokenizer; -using Poco::Exception; -using Poco::Process; -using Poco::Util::Application; -using Poco::File; -using Poco::Path; +using Poco::Thread; using Poco::ThreadLocal; +using Poco::Util::Application; const std::string CHILD_URI = "/loolws/child/"; const std::string FIFO_PATH = "pipe"; diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp index 32f3e7c..1ffeb21 100644 --- a/loolwsd/LOOLSession.cpp +++ b/loolwsd/LOOLSession.cpp @@ -24,13 +24,7 @@ #include <mutex> #include <set> -#define LOK_USE_UNSTABLE_API -#include <LibreOfficeKit/LibreOfficeKit.h> -#include <LibreOfficeKit/LibreOfficeKitEnums.h> - -#include <Poco/Exception.h> #include <Poco/Exception.h> -#include <Poco/Net/NetException.h> #include <Poco/Net/WebSocket.h> #include <Poco/Path.h> #include <Poco/String.h> diff --git a/loolwsd/LOOLSession.hpp b/loolwsd/LOOLSession.hpp index 6b57a96..2fd660e 100644 --- a/loolwsd/LOOLSession.hpp +++ b/loolwsd/LOOLSession.hpp @@ -18,9 +18,6 @@ #include <ostream> #include <set> -#define LOK_USE_UNSTABLE_API -#include <LibreOfficeKit/LibreOfficeKit.h> - #include <Poco/Net/WebSocket.h> #include <Poco/Buffer.h> #include <Poco/Path.h> diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index 85ef1c9..019d916 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -55,8 +55,8 @@ DEALINGS IN THE SOFTWARE. #include <cstdlib> #include <cstring> #include <iostream> -#include <sstream> #include <mutex> +#include <sstream> #include <Poco/Exception.h> #include <Poco/File.h> @@ -135,11 +135,11 @@ using Poco::Random; using Poco::Runnable; using Poco::StreamCopier; using Poco::StringTokenizer; -using Poco::Timespan; using Poco::TemporaryFile; using Poco::Thread; using Poco::ThreadLocal; using Poco::ThreadPool; +using Poco::Timespan; using Poco::URI; using Poco::Util::Application; using Poco::Util::HelpFormatter; diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp index a41cceb..0997fb2 100644 --- a/loolwsd/LOOLWSD.hpp +++ b/loolwsd/LOOLWSD.hpp @@ -10,21 +10,19 @@ #ifndef INCLUDED_LOOLWSD_HPP #define INCLUDED_LOOLWSD_HPP -#include "config.h" - -#include <string> -#include <mutex> #include <atomic> +#include <mutex> +#include <string> -#include <Poco/Util/OptionSet.h> -#include <Poco/Random.h> #include <Poco/Path.h> -#include <Poco/Util/ServerApplication.h> #include <Poco/Process.h> +#include <Poco/Random.h> +#include <Poco/Util/OptionSet.h> +#include <Poco/Util/ServerApplication.h> #include "Auth.hpp" -#include "Storage.hpp" #include "Common.hpp" +#include "Storage.hpp" #include "Util.hpp" /// A DocumentURI as mananged by us. diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index cb2b82c..7c9d23b 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -18,8 +18,8 @@ #include "LOOLSession.hpp" #include "LOOLWSD.hpp" #include "MasterProcessSession.hpp" -#include "Util.hpp" #include "Rectangle.hpp" +#include "Util.hpp" using namespace LOOLProtocol; diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp index 4b9149e..9777c59 100644 --- a/loolwsd/MessageQueue.hpp +++ b/loolwsd/MessageQueue.hpp @@ -10,8 +10,6 @@ #ifndef INCLUDED_MESSAGEQUEUE_HPP #define INCLUDED_MESSAGEQUEUE_HPP -#include "config.h" - #include <condition_variable> #include <mutex> #include <deque> diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp index aa35696..dc419c8 100644 --- a/loolwsd/Util.cpp +++ b/loolwsd/Util.cpp @@ -10,29 +10,29 @@ #include <sys/poll.h> #include <sys/prctl.h> +#include <cassert> #include <cstdlib> #include <cstring> #include <iomanip> +#include <mutex> +#include <random> #include <sstream> #include <string> -#include <cassert> -#include <random> -#include <mutex> #include <png.h> #include <signal.h> +#include <Poco/ConsoleChannel.h> #include <Poco/Exception.h> #include <Poco/Format.h> #include <Poco/Net/WebSocket.h> #include <Poco/Process.h> -#include <Poco/Timestamp.h> #include <Poco/Thread.h> +#include <Poco/Timestamp.h> #include <Poco/Util/Application.h> -#include <Poco/ConsoleChannel.h> -#include <Common.hpp> +#include "Common.hpp" #include "Util.hpp" #include "Png.hpp" commit 61ee1ae842de390c224c6f455e1743d178bdee03 Author: Tor Lillqvist <[email protected]> Date: Tue Mar 8 09:16:01 2016 +0200 Use std::getenv() instead of Poco::Environment::get() Much simpler. Also, don't duplicate the code informing that LD_BIND_NOW or LOK_VIEW_CALLBACK are not set. Not that I understand why we need to inform about that? If the "normal" thing should be that they are set, why don't make it so by default then? diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp index 94005bf..29c6d46 100644 --- a/loolwsd/LOOLBroker.cpp +++ b/loolwsd/LOOLBroker.cpp @@ -648,23 +648,11 @@ int main(int argc, char** argv) std::exit(Application::EXIT_SOFTWARE); } - try - { - Poco::Environment::get("LD_BIND_NOW"); - } - catch (const Poco::NotFoundException& exc) - { - Log::warn("Note: LD_BIND_NOW is not set."); - } + if (!std::getenv("LD_BIND_NOW")) + Log::info("Note: LD_BIND_NOW is not set."); - try - { - Poco::Environment::get("LOK_VIEW_CALLBACK"); - } - catch (const Poco::NotFoundException& exc) - { - Log::warn("Note: LOK_VIEW_CALLBACK is not set."); - } + if (!std::getenv("LOK_VIEW_CALLBACK")) + Log::info("Note: LOK_VIEW_CALLBACK is not set."); int pipeFlags = O_RDONLY | O_NONBLOCK; const std::string pipeBroker = Path(pipePath, FIFO_BROKER).toString(); diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp index a109b51..dc204fc 100644 --- a/loolwsd/LOOLKit.cpp +++ b/loolwsd/LOOLKit.cpp @@ -36,7 +36,6 @@ #include <Poco/StringTokenizer.h> #include <Poco/Exception.h> #include <Poco/Process.h> -#include <Poco/Environment.h> #include <Poco/Mutex.h> #include <Poco/Net/NetException.h> #include <Poco/Util/Application.h> @@ -1135,24 +1134,6 @@ int main(int argc, char** argv) std::exit(Application::EXIT_SOFTWARE); } - try - { - Poco::Environment::get("LD_BIND_NOW"); - } - catch (const Poco::NotFoundException& exc) - { - Log::warn("Note: LD_BIND_NOW is not set."); - } - - try - { - Poco::Environment::get("LOK_VIEW_CALLBACK"); - } - catch (const Poco::NotFoundException& exc) - { - Log::warn("Note: LOK_VIEW_CALLBACK is not set."); - } - lokit_main(childRoot, sysTemplate, loTemplate, loSubPath, pipe); return Application::EXIT_OK; diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp index dec4602..85ef1c9 100644 --- a/loolwsd/LOOLWSD.cpp +++ b/loolwsd/LOOLWSD.cpp @@ -58,7 +58,6 @@ DEALINGS IN THE SOFTWARE. #include <sstream> #include <mutex> -#include <Poco/Environment.h> #include <Poco/Exception.h> #include <Poco/File.h> #include <Poco/FileStream.h> @@ -107,7 +106,6 @@ DEALINGS IN THE SOFTWARE. using namespace LOOLProtocol; -using Poco::Environment; using Poco::Exception; using Poco::File; using Poco::FileOutputStream; @@ -910,10 +908,6 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/) return Application::EXIT_USAGE; } - //Environment::set("LOK_FORK", "1"); - //Environment::set("LD_BIND_NOW", "1"); - //Environment::set("LOK_VIEW_CALLBACK", "1"); - char *locale = setlocale(LC_ALL, nullptr); if (locale == nullptr || std::strcmp(locale, "C") == 0) setlocale(LC_ALL, "en_US.utf8"); diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp index 92c8456..aa35696 100644 --- a/loolwsd/Util.cpp +++ b/loolwsd/Util.cpp @@ -30,7 +30,6 @@ #include <Poco/Timestamp.h> #include <Poco/Thread.h> #include <Poco/Util/Application.h> -#include <Poco/Environment.h> #include <Poco/ConsoleChannel.h> #include <Common.hpp> @@ -120,16 +119,11 @@ namespace Log // Configure the logger. // TODO: This should come from a file. - try - { - // See Poco::Logger::setLevel docs for values. - // Try: error, information, debug - const auto level = Poco::Environment::get("LOOL_LOGLEVEL"); - logger.setLevel(level); - } - catch (Poco::NotFoundException& aError) - { - } + // See Poco::Logger::setLevel docs for values. + // Try: error, information, debug + char *loglevel = std::getenv("LOOL_LOGLEVEL"); + if (loglevel) + logger.setLevel(std::string(loglevel)); info("Initializing " + name); info("Log level is [" + std::to_string(logger.getLevel()) + "]."); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
