From 20d2a17dccd77f5b31e41a170bacc656fa5acc7d Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 19 Aug 2022 15:05:52 +0200 Subject: Added net_accountListenToGameHost config option This is because the network interface on which the account server listens to the game server does not need to match the one on which the account server listens to the client. --- src/account-server/main-account.cpp | 4 +++- src/game-server/accountconnection.cpp | 3 ++- src/net/connectionhandler.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp index b3edf207..e14b301f 100644 --- a/src/account-server/main-account.cpp +++ b/src/account-server/main-account.cpp @@ -331,6 +331,8 @@ int main(int argc, char *argv[]) std::string accountHost = Configuration::getValue("net_accountHost", "localhost"); + std::string accountListenToGameHost = Configuration::getValue("net_accountListenToGameHost", + accountHost); // We separate the chat host as the chat server will be separated out // from the account server. @@ -354,7 +356,7 @@ int main(int argc, char *argv[]) if (!AccountClientHandler::initialize(DEFAULT_ATTRIBUTEDB_FILE, options.port, accountHost) || - !GameServerHandler::initialize(accountGamePort, accountHost) || + !GameServerHandler::initialize(accountGamePort, accountListenToGameHost) || !chatHandler->startListen(chatClientPort, chatHost)) { LOG_FATAL("Unable to create an ENet server host."); diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 6b7b728a..546ae5ae 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -56,7 +56,8 @@ AccountConnection::~AccountConnection() bool AccountConnection::start(int gameServerPort) { const std::string accountServerAddress = - Configuration::getValue("net_accountHost", "localhost"); + Configuration::getValue("net_accountListenToGameHost", + Configuration::getValue("net_accountHost", "localhost")); // When the accountListenToGamePort is set, we use it. // Otherwise, we use the accountListenToClientPort + 1 if the option is set. diff --git a/src/net/connectionhandler.cpp b/src/net/connectionhandler.cpp index f1bcf5ff..edf46dba 100644 --- a/src/net/connectionhandler.cpp +++ b/src/net/connectionhandler.cpp @@ -45,7 +45,7 @@ bool ConnectionHandler::startListen(enet_uint16 port, if (!listenHost.empty()) enet_address_set_host(&address, listenHost.c_str()); - LOG_INFO("Listening on port " << port << "..."); + LOG_INFO("Listening on " << listenHost << ":" << port << "..."); #if defined(ENET_VERSION) && ENET_VERSION >= ENET_CUTOFF host = enet_host_create( &address /* the address to bind the server host to */, -- cgit v1.2.3-70-g09d2