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, ...)
}
}
// ======================================================================
// ======================================================================
@@ -38,13 +38,26 @@ bool TaskGetClusterList::process(DB::Session *session)
while ((rowsFetched = qry.fetch()) > 0)
{
qry.altAddress.getValue(temp.m_address);
if (temp.m_address.empty())
{
qry.address.getValue(temp.m_address);
}
DEBUG_WARNING(true, ("Customer facing cluster address is %s", temp.m_address.c_str()));
if (qry.port.isNull())
{
temp.m_port = ConfigLoginServer::getCentralServicePort();
}
else
{
temp.m_port = static_cast<uint16>(qry.port.getValue());
}
qry.cluster_id.getValue(temp.m_clusterId);
qry.cluster_name.getValue(temp.m_clusterName);
qry.address.getValue(temp.m_address);
if (qry.port.isNull())
temp.m_port = ConfigLoginServer::getCentralServicePort();
else
temp.m_port = static_cast<uint16>(qry.port.getValue());
qry.secret.getValue(temp.m_secret);
qry.locked.getValue(temp.m_locked);
qry.not_recommended.getValue(temp.m_notRecommended);
@@ -75,7 +88,7 @@ void TaskGetClusterList::onComplete()
void TaskGetClusterList::GetClustersQuery::getSQL(std::string &sql)
{
sql=std::string("begin :result := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_cluster_list(:group_id); end;";
// DEBUG_REPORT_LOG(true, ("TaskGetClusterList SQL: %s\n", sql.c_str()));
DEBUG_REPORT_LOG(true, ("TaskGetClusterList SQL: %s\n", sql.c_str()));
}
@@ -94,6 +107,7 @@ bool TaskGetClusterList::GetClustersQuery::bindColumns()
if (!bindCol(cluster_id)) return false;
if (!bindCol(cluster_name)) return false;
if (!bindCol(address)) return false;
if (!bindCol(altAddress)) return false;
if (!bindCol(port)) return false;
if (!bindCol(secret)) return false;
if (!bindCol(locked)) return false;
@@ -122,6 +136,7 @@ TaskGetClusterList::GetClustersQuery::GetClustersQuery() :
cluster_id(),
cluster_name(),
address(),
altAddress(),
port(),
secret(),
locked(),
@@ -36,6 +36,7 @@ class TaskGetClusterList : public DB::TaskRequest
DB::BindableLong cluster_id; //lint !e1925 // public data member
DB::BindableString<255> cluster_name; //lint !e1925 // public data member
DB::BindableString<255> address; //lint !e1925 // public data member
DB::BindableString<255> altAddress; //lint !e1925 // public data member
DB::BindableLong port; //lint !e1925 // public data member
DB::BindableBool secret; //lint !e1925 // public data member
DB::BindableBool locked; //lint !e1925 // public data member
@@ -63,6 +64,7 @@ class TaskGetClusterList : public DB::TaskRequest
uint32 m_clusterId;
std::string m_clusterName;
std::string m_address;
std::string m_altAddress;
uint16 m_port;
bool m_secret;
bool m_locked;
@@ -32,7 +32,7 @@ as
from default_char_limits;
open result_cursor for
select id, name, address, port, secret, locked, not_recommended, maxCharacterPerAccount,
select id, name, address, altAddress, port, secret, locked, not_recommended, maxCharacterPerAccount,
online_player_limit,online_free_trial_limit,free_trial_can_create_char,online_tutorial_limit
from cluster_list
where group_id = p_group;
@@ -4,6 +4,7 @@ create table cluster_list --NO_IMPORT
name varchar2(255),
num_characters number,
address varchar2(255),
altAddress varchar2(255),
port number default 44463,
secret char(1),
locked char(1),
+1
View File
@@ -1,4 +1,5 @@
alter table cluster_list add address varchar2(255);
alter table cluster_list add altAddress varchar2(255);
alter table cluster_list add port number;
alter table cluster_list add secret char(1);
update cluster_list set secret='N';