summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-11-02 07:59:59 +0000
committerAndras Timar <andras.timar@collabora.com>2016-11-02 10:25:37 +0100
commit60b1623e53d04dff69e7001c3b3fea3817be3dd6 (patch)
tree0e3c18c48d0daf0e70e8efc4b538ff0d4aae11f9
parent5704f956f924f75458211ef711058f539abdedc5 (diff)
Disable port re-use for internal unit-tests, so we find a free socket.2.0-beta31.9.6
(cherry picked from commit a28b3d0d7e5f0cae2c78a6749c6600028088feeb)
-rw-r--r--loolwsd/LOOLWSD.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 2a74663a0..4d329056b 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1313,14 +1313,14 @@ public:
namespace
{
-static inline ServerSocket* getServerSocket(int nClientPortNumber)
+static inline ServerSocket* getServerSocket(int nPortNumber, bool reuseDetails)
{
try
{
ServerSocket* socket = LOOLWSD::isSSLEnabled() ? new SecureServerSocket() : new ServerSocket();
Poco::Net::IPAddress wildcardAddr;
- SocketAddress address(wildcardAddr, nClientPortNumber);
- socket->bind(address, true);
+ SocketAddress address(wildcardAddr, nPortNumber);
+ socket->bind(address, reuseDetails);
// 64 is the default value for the backlog parameter in Poco
// when creating a ServerSocket, so use it here, too.
socket->listen(64);
@@ -1338,7 +1338,7 @@ static inline ServerSocket* findFreeServerPort(int& nClientPortNumber)
ServerSocket* socket = nullptr;
while (!socket)
{
- socket = getServerSocket(nClientPortNumber);
+ socket = getServerSocket(nClientPortNumber, false);
if (!socket)
{
nClientPortNumber++;
@@ -1368,7 +1368,7 @@ ServerSocket* findFreeMasterPort(int &nMasterPortNumber)
ServerSocket* socket = nullptr;
while (!socket)
{
- socket = getServerSocket(nMasterPortNumber);
+ socket = getServerSocket(nMasterPortNumber, false);
if (!socket)
{
nMasterPortNumber++;
@@ -1911,7 +1911,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
std::unique_ptr<ServerSocket> psvs(
UnitWSD::isUnitTesting() ?
findFreeServerPort(ClientPortNumber) :
- getServerSocket(ClientPortNumber));
+ getServerSocket(ClientPortNumber, true));
if (!psvs)
return Application::EXIT_SOFTWARE;