[Libreoffice-commits] online.git: loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp

Henry Castro hcastro at collabora.com
Fri Jul 17 14:56:29 PDT 2015


 loolwsd/LOOLWSD.cpp |   64 +++++++++++++++++++++++-----------------------------
 loolwsd/LOOLWSD.hpp |    1 
 2 files changed, 29 insertions(+), 36 deletions(-)

New commits:
commit 63a33b39f69b674ca835fdef7a1f06d6f6e81928
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Jul 17 17:55:27 2015 -0400

    loolwsd: moved server socket to main function.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 76d4a73..ec7288f 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -998,9 +998,36 @@ void LOOLWSD::startupDesktop(int nDesktops)
     }
 }
 
-
-void LOOLWSD::loolMain()
+int LOOLWSD::main(const std::vector<std::string>& args)
 {
+    if (access(cache.c_str(), R_OK | W_OK | X_OK) != 0)
+    {
+        std::cout << "Unable to access " << cache <<
+            ", please make sure it exists, and has write permission for this user." << std::endl;
+        return Application::EXIT_UNAVAILABLE;
+    }
+
+    // We use the same option set for both parent and child loolwsd,
+    // so must check options required in the parent (but not in the
+    // child) separately now. Also check for options that are
+    // meaningless for the parent.
+    if (sysTemplate == "")
+        throw MissingOptionException("systemplate");
+    if (loTemplate == "")
+        throw MissingOptionException("lotemplate");
+    if (childRoot == "")
+        throw MissingOptionException("childroot");
+
+    if (_childId != 0)
+        throw IncompatibleOptionsException("child");
+    if (jail != "")
+        throw IncompatibleOptionsException("jail");
+    if (portNumber == MASTER_PORT_NUMBER)
+        throw IncompatibleOptionsException("port");
+
+    if (_doTest)
+        _numPreSpawnedChildren = 1;
+
     std::unique_lock<std::mutex> rngLock(_rngMutex);
     _childId = (((Poco::UInt64)_rng.next()) << 32) | _rng.next() | 1;
     rngLock.unlock();
@@ -1074,39 +1101,6 @@ void LOOLWSD::loolMain()
         logger().information(Util::logPrefix() + "Requesting child process " + std::to_string(i.first) + " to terminate");
         Process::requestTermination(i.first);
     }
-}
-
-int LOOLWSD::main(const std::vector<std::string>& args)
-{
-    if (access(cache.c_str(), R_OK | W_OK | X_OK) != 0)
-    {
-        std::cout << "Unable to access " << cache <<
-            ", please make sure it exists, and has write permission for this user." << std::endl;
-        return Application::EXIT_UNAVAILABLE;
-    }
-
-    // We use the same option set for both parent and child loolwsd,
-    // so must check options required in the parent (but not in the
-    // child) separately now. Also check for options that are
-    // meaningless for the parent.
-    if (sysTemplate == "")
-        throw MissingOptionException("systemplate");
-    if (loTemplate == "")
-        throw MissingOptionException("lotemplate");
-    if (childRoot == "")
-        throw MissingOptionException("childroot");
-
-    if (_childId != 0)
-        throw IncompatibleOptionsException("child");
-    if (jail != "")
-        throw IncompatibleOptionsException("jail");
-    if (portNumber == MASTER_PORT_NUMBER)
-        throw IncompatibleOptionsException("port");
-
-    if (_doTest)
-        _numPreSpawnedChildren = 1;
-
-    loolMain();
 
     return Application::EXIT_OK;
 }
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 51e05ad..befed88 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -55,7 +55,6 @@ private:
     bool childMode() const;
     void componentMain();
     void desktopMain();
-    void loolMain();
     void startupComponent(int nComponents);
     void startupDesktop(int nDesktop);
     int  createComponent();


More information about the Libreoffice-commits mailing list