[Libreoffice-commits] online.git: loolwsd/Common.hpp loolwsd/Connect.cpp loolwsd/LoadTest.cpp loolwsd/LOOLBroker.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp loolwsd/Makefile.am

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sun Dec 27 20:10:08 PST 2015


 loolwsd/Common.hpp      |   21 +++++++++++++++++++++
 loolwsd/Connect.cpp     |    3 ++-
 loolwsd/LOOLBroker.cpp  |    1 +
 loolwsd/LOOLKit.cpp     |    2 +-
 loolwsd/LOOLSession.cpp |    1 +
 loolwsd/LOOLWSD.cpp     |    7 ++++---
 loolwsd/LOOLWSD.hpp     |    5 -----
 loolwsd/LoadTest.cpp    |    3 ++-
 loolwsd/Makefile.am     |    3 ++-
 9 files changed, 34 insertions(+), 12 deletions(-)

New commits:
commit d273057488da832bbf431d9b53e7894bb237144a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Dec 27 17:23:43 2015 -0500

    loolwsd: moved config values into common header
    
    Change-Id: Ib88379e453f207a6a5e6223045a393c769082be4
    Reviewed-on: https://gerrit.libreoffice.org/20978
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/Common.hpp b/loolwsd/Common.hpp
new file mode 100644
index 0000000..e5c9406
--- /dev/null
+++ b/loolwsd/Common.hpp
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Default values and other shared data between processes.
+#ifndef INCLUDED_COMMON_HPP
+#define INCLUDED_COMMON_HPP
+
+static const int DEFAULT_CLIENT_PORT_NUMBER = 9980;
+static const int MASTER_PORT_NUMBER = 9981;
+static const int INTERVAL_PROBES = 10;
+static const int MAINTENANCE_INTERVAL = 1;
+static const int POLL_TIMEOUT = 1000000;
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/Connect.cpp b/loolwsd/Connect.cpp
index 48f07df..4a74663 100644
--- a/loolwsd/Connect.cpp
+++ b/loolwsd/Connect.cpp
@@ -32,6 +32,7 @@
 #include <Poco/Util/Option.h>
 #include <Poco/Util/OptionSet.h>
 
+#include "Common.hpp"
 #include "LOOLProtocol.hpp"
 #include "LOOLWSD.hpp"
 #include "Util.hpp"
@@ -115,7 +116,7 @@ class Connect: public Poco::Util::Application
 {
 public:
     Connect() :
-        _uri("http://127.0.0.1:" + std::to_string(LOOLWSD::DEFAULT_CLIENT_PORT_NUMBER) + "/ws")
+        _uri("http://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "/ws")
     {
     }
 
diff --git a/loolwsd/LOOLBroker.cpp b/loolwsd/LOOLBroker.cpp
index 99e4e8d..c82b564 100644
--- a/loolwsd/LOOLBroker.cpp
+++ b/loolwsd/LOOLBroker.cpp
@@ -32,6 +32,7 @@
 #include <Poco/Thread.h>
 #include <Poco/NamedMutex.h>
 
+#include "Common.hpp"
 #include "Util.hpp"
 
 // First include the grist of the helper process - ideally
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 3745089..c9e893f 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -37,6 +37,7 @@
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKitInit.h>
 
+#include "Common.hpp"
 #include "MessageQueue.hpp"
 #include "Util.hpp"
 #include "ChildProcessSession.hpp"
@@ -56,7 +57,6 @@ using Poco::Notification;
 using Poco::NotificationQueue;
 using Poco::FastMutex;
 
-const int MASTER_PORT_NUMBER = 9981;
 const std::string CHILD_URI = "/loolws/child/";
 const std::string LOKIT_BROKER = "/tmp/loolbroker.fifo";
 
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index f78abfe..2e951c9 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -207,4 +207,5 @@ bool LOOLSession::handleInput(const char *buffer, int length)
 
     return false;
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 5d80a7e..f736d47 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -103,6 +103,7 @@ DEALINGS IN THE SOFTWARE.
 #include <Poco/URI.h>
 #include <Poco/Environment.h>
 
+#include "Common.hpp"
 #include "LOOLProtocol.hpp"
 #include "LOOLSession.hpp"
 #include "MasterProcessSession.hpp"
@@ -316,7 +317,7 @@ public:
     void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) override
     {
         std::string thread_name;
-        if (request.serverAddress().port() == LOOLWSD::MASTER_PORT_NUMBER)
+        if (request.serverAddress().port() == MASTER_PORT_NUMBER)
             thread_name = "prision_socket";
         else
             thread_name = "client_socket";
@@ -439,7 +440,7 @@ public:
         BasicTileQueue queue;
         Thread queueHandlerThread;
         QueueHandler handler(queue);
-        Poco::Timespan waitTime(LOOLWSD::POLL_TIMEOUT);
+        Poco::Timespan waitTime(POLL_TIMEOUT);
 
         try
         {
@@ -449,7 +450,7 @@ public:
 
                 LOOLSession::Kind kind;
 
-                if (request.getURI() == LOOLWSD::CHILD_URI && request.serverAddress().port() == LOOLWSD::MASTER_PORT_NUMBER)
+                if (request.getURI() == LOOLWSD::CHILD_URI && request.serverAddress().port() == MASTER_PORT_NUMBER)
                     kind = LOOLSession::Kind::ToPrisoner;
                 else
                     kind = LOOLSession::Kind::ToClient;
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index e14b0e4..a4b9058 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -45,11 +45,6 @@ public:
     static Poco::NamedMutex _namedMutexLOOL;
     static Poco::UInt64 _childId;
 
-    static const int DEFAULT_CLIENT_PORT_NUMBER = 9980;
-    static const int MASTER_PORT_NUMBER = 9981;
-    static const int INTERVAL_PROBES = 10;
-    static const int MAINTENANCE_INTERVAL = 1;
-    static const int POLL_TIMEOUT = 1000000;
     static const std::string CHILD_URI;
     static const std::string PIDLOG;
     static const std::string FIFO_FILE;
diff --git a/loolwsd/LoadTest.cpp b/loolwsd/LoadTest.cpp
index 06bbaf3..988b9e4 100644
--- a/loolwsd/LoadTest.cpp
+++ b/loolwsd/LoadTest.cpp
@@ -38,6 +38,7 @@
 #include <Poco/Util/Option.h>
 #include <Poco/Util/OptionSet.h>
 
+#include "Common.hpp"
 #include "LoadTest.hpp"
 #include "LOOLProtocol.hpp"
 #include "LOOLWSD.hpp"
@@ -271,7 +272,7 @@ LoadTest::LoadTest() :
     _numClients(20),
     _numDocsPerClient(500),
     _duration(6),
-    _url("http://127.0.0.1:" + std::to_string(LOOLWSD::DEFAULT_CLIENT_PORT_NUMBER) + "/ws")
+    _url("http://127.0.0.1:" + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "/ws")
 {
 }
 
diff --git a/loolwsd/Makefile.am b/loolwsd/Makefile.am
index 02fe176..02cfa0d 100644
--- a/loolwsd/Makefile.am
+++ b/loolwsd/Makefile.am
@@ -27,7 +27,8 @@ loolbroker_SOURCES = LOOLBroker.cpp $(broker_shared_sources)
 
 loolmap_SOURCES = loolmap.c
 
-noinst_HEADERS = LOKitHelper.hpp LOOLProtocol.hpp LOOLSession.hpp MasterProcessSession.hpp ChildProcessSession.hpp LOOLWSD.hpp LoadTest.hpp MessageQueue.hpp TileCache.hpp Util.hpp Png.hpp \
+noinst_HEADERS = LOKitHelper.hpp LOOLProtocol.hpp LOOLSession.hpp MasterProcessSession.hpp ChildProcessSession.hpp \
+				 LOOLWSD.hpp LoadTest.hpp MessageQueue.hpp TileCache.hpp Util.hpp Png.hpp Common.hpp \
                  bundled/include/LibreOfficeKit/LibreOfficeKit.h bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h \
                  bundled/include/LibreOfficeKit/LibreOfficeKitInit.h bundled/include/LibreOfficeKit/LibreOfficeKitTypes.h
 


More information about the Libreoffice-commits mailing list