ConnectionServer: add altPublicBindAddress config option

This commit is contained in:
DarthArgus
2016-09-26 06:27:45 +00:00
parent e0bd4f3c02
commit 05f8a322fb
8 changed files with 53 additions and 9 deletions
@@ -113,6 +113,8 @@ void ConfigConnectionServer::install(void)
KEY_INT (connectionServerNumber, 0);
KEY_INT (fakeBuddyPoints, 0);
KEY_STRING (altPublicBindAddress, "");
int index = 0;
char const * result = 0;
do
@@ -163,4 +165,11 @@ int ConfigConnectionServer::getFakeBuddyPoints()
return data->fakeBuddyPoints;
}
// ----------------------------------------------------------------------
const char * ConfigConnectionServer::getPublicBindAddress()
{
return data->altPublicBindAddress;
}
// ======================================================================
@@ -68,6 +68,8 @@ public:
int connectionServerNumber;
int fakeBuddyPoints;
const char * altPublicBindAddress;
};
@@ -133,6 +135,7 @@ public:
static int getConnectionServerNumber();
static int getFakeBuddyPoints();
static const char * getPublicBindAddress();
private:
static Data * data;
};
@@ -484,7 +484,9 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId
uint16 chatPort = 0;
uint16 csPort = 0;
if (c)
{
chatPort = c->getBindPort();
}
if (cs)
{
@@ -493,12 +495,21 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId
uint16 publicPort = 0;
if (servicePublic)
{
publicPort = servicePublic->getBindPort();
}
uint16 privatePort = 0;
if (servicePrivate)
{
privatePort = servicePrivate->getBindPort();
}
std::string clientServicePublicBindAddress = NetworkHandler::getHostName();
std::string clientServicePublicBindAddress = ConfigConnectionServer::getPublicBindAddress();
if (clientServicePublicBindAddress.empty())
{
clientServicePublicBindAddress = NetworkHandler::getHostName();
}
NOT_NULL(gameService);
NOT_NULL(chatService);
@@ -508,7 +519,9 @@ void ConnectionServer::handleConnectionServerIdMessage(const ConnectionServerId
sendToCentralProcess(ncs);
}
else
{
FATAL(true, ("Error in connection server startup"));
}
}
// ----------------------------------------------------------------------
@@ -1566,4 +1579,4 @@ void ConnectionServer::setDone(char const *reasonfmt, ...)
}
}
// ======================================================================
// ======================================================================