[Libreoffice-commits] online.git: loolwsd/LOOLForKit.cpp loolwsd/LOOLWSD.cpp
Michael Meeks
michael.meeks at collabora.com
Wed Oct 26 14:51:47 UTC 2016
loolwsd/LOOLForKit.cpp | 6 +++++-
loolwsd/LOOLWSD.cpp | 8 ++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
New commits:
commit 87d5849176aa0b209fe805d66ca76c66c6eb3759
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Oct 26 14:40:46 2016 +0100
Pass master port number to forkit.
Fixes issues with free port selection.
diff --git a/loolwsd/LOOLForKit.cpp b/loolwsd/LOOLForKit.cpp
index 9272933..0bd55e8 100644
--- a/loolwsd/LOOLForKit.cpp
+++ b/loolwsd/LOOLForKit.cpp
@@ -297,7 +297,6 @@ int main(int argc, char** argv)
static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT");
if (clientPort)
ClientPortNumber = std::stoi(clientPort);
-
static const char* masterPort = std::getenv("LOOL_TEST_MASTER_PORT");
if (masterPort)
MasterPortNumber = std::stoi(masterPort);
@@ -332,6 +331,11 @@ int main(int argc, char** argv)
eq = std::strchr(cmd, '=');
ClientPortNumber = std::stoll(std::string(eq+1));
}
+ else if (std::strstr(cmd, "--masterport=") == cmd)
+ {
+ eq = std::strchr(cmd, '=');
+ MasterPortNumber = std::stoll(std::string(eq+1));
+ }
else if (std::strstr(cmd, "--version") == cmd)
{
std::string version, hash;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 3eefd6d..235c2b5 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1718,8 +1718,9 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
.required(false)
.repeatable(false));
- optionSet.addOption(Option("port", "", "Port number to listen to (default: " + std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "),"
- " must not be " + std::to_string(MasterPortNumber) + ".")
+ optionSet.addOption(Option("port", "", "Port number to listen to (default: " +
+ std::to_string(DEFAULT_CLIENT_PORT_NUMBER) + "),"
+ " must not be " + std::to_string(MasterPortNumber) + ".")
.required(false)
.repeatable(false)
.argument("port number"));
@@ -1809,6 +1810,7 @@ Process::PID LOOLWSD::createForKit()
args.push_back("--lotemplate=" + LoTemplate);
args.push_back("--childroot=" + ChildRoot);
args.push_back("--clientport=" + std::to_string(ClientPortNumber));
+ args.push_back("--masterport=" + std::to_string(MasterPortNumber));
if (UnitWSD::get().hasKitHooks())
args.push_back("--unitlib=" + UnitTestLibrary);
if (DisplayVersion)
@@ -1957,6 +1959,8 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
while (!TerminationFlag)
{
UnitWSD::get().invokeTest();
+ if (TerminationFlag)
+ break;
const pid_t pid = waitpid(forKitPid, &status, WUNTRACED | WNOHANG);
if (pid > 0)
More information about the Libreoffice-commits
mailing list