summaryrefslogtreecommitdiff
path: root/src/account-server/main-account.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-15 14:35:22 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-16 18:25:58 +0100
commit01489b9930025bed3c5bfc34b6c86045cbaccb46 (patch)
tree2820d4a62f0562168cee7b989fd611adfff0da70 /src/account-server/main-account.cpp
parentcee7b8909d3591ad851ac7b31753b83fbfdabfa5 (diff)
downloadmanaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.gz
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.bz2
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.xz
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.zip
Deharcoded the host and port options for each servers.
Changes: ============================================================ For the account server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_accountServerAddress, net_listenHost -> net_accountHost net_accountServerPort -> net_accountListenToClientPort net_accountServerPort +1 -> net_accountListenToGamePort For the game server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_gameServerAddress -> net_gameHost net_gameServerPort -> net_gameListenToClientPort For the chat server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ -> net_chatHost net_accountServerPort + 2 -> net_chatListenToClientPort Special fallback feature, as requested by Freeyorp: When the net_accountListenToClientPort (default to 9601) is set, the 3 others ports will automatically offset from it, if they're not set, following this rule: net_accountListenToGamePort = net_accountListenToClientPort + 1 net_chatListenToClientPort = net_accountListenToClientPort + 2 net_gameListenToClientPort = net_accountListenToClientPort + 3 Resolves: Mana-Mantis #216. Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/account-server/main-account.cpp')
-rw-r--r--src/account-server/main-account.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index 9516b4d1..a0e935dd 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -368,15 +368,30 @@ int main(int argc, char *argv[])
options.verbosity) );
Logger::setVerbosity(options.verbosity);
+ std::string accountHost = Configuration::getValue("net_accountHost",
+ "localhost");
+
+ // We separate the chat host as the chat server will be separated out
+ // from the account server.
+ std::string chatHost = Configuration::getValue("net_chatHost",
+ "localhost");
+
+ // Setting the listen ports
+ // Note: The accountToGame and chatToClient listen ports auto offset
+ // to accountToClient listen port when they're not set,
+ // or to DEFAULT_SERVER_PORT otherwise.
if (!options.portChanged)
- options.port = Configuration::getValue("net_accountServerPort",
+ options.port = Configuration::getValue("net_accountListenToClientPort",
options.port);
+ int accountGamePort = Configuration::getValue("net_accountListenToGamePort",
+ options.port + 1);
+ int chatClientPort = Configuration::getValue("net_chatListenToClientPort",
+ options.port + 2);
- std::string host = Configuration::getValue("net_listenHost", std::string());
if (!AccountClientHandler::initialize(DEFAULT_ATTRIBUTEDB_FILE,
- options.port, host) ||
- !GameServerHandler::initialize(options.port + 1, host) ||
- !chatHandler->startListen(options.port + 2, host))
+ options.port, accountHost) ||
+ !GameServerHandler::initialize(accountGamePort, accountHost) ||
+ !chatHandler->startListen(chatClientPort, chatHost))
{
LOG_FATAL("Unable to create an ENet server host.");
return EXIT_NET_EXCEPTION;