diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-22 00:02:05 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-09-22 00:02:05 +0200 |
commit | 4b0892691729e5efba27c796e29002b1e1d54166 (patch) | |
tree | 80daf14e04fdb7dbc76a16759ed310fec20d5ce7 /src/account-server/main-account.cpp | |
parent | 4c0ba5cf58f09926f5b06ed0e91a5f7d6878c1f8 (diff) | |
download | manaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.gz manaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.bz2 manaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.xz manaserv-4b0892691729e5efba27c796e29002b1e1d54166.zip |
Centralized the servers' exit values.
Also made random code format clean-ups.
Resolves: Mana-Mantis #217
Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/account-server/main-account.cpp')
-rw-r--r-- | src/account-server/main-account.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp index 733369d7..0be05abe 100644 --- a/src/account-server/main-account.cpp +++ b/src/account-server/main-account.cpp @@ -39,6 +39,7 @@ #include "utils/processorutils.hpp" #include "utils/stringfilter.h" #include "utils/timer.h" +#include "defines.h" #include <cstdlib> #include <getopt.h> @@ -106,7 +107,7 @@ static void initializeConfiguration(std::string configPath = std::string()) { LOG_FATAL("Refusing to run without configuration!" << std::endl << "Invalid config path: " << configPath << "."); - exit(1); + exit(EXIT_CONFIG_NOT_FOUND); } } @@ -116,7 +117,7 @@ static void initializeConfiguration(std::string configPath = std::string()) if (Configuration::getValue("net_password", "") == "") { LOG_FATAL("SECURITY WARNING: 'net_password' not set!"); - exit(3); + exit(EXIT_BAD_CONFIG_PARAMETER); } } @@ -169,7 +170,7 @@ static void initialize() catch (std::string &error) { LOG_FATAL("Error opening the database: " << error); - exit(1); + exit(EXIT_DB_EXCEPTION); } // --- Initialize the managers @@ -188,7 +189,7 @@ static void initialize() if (enet_initialize() != 0) { LOG_FATAL("An error occurred while initializing ENet"); - exit(2); + exit(EXIT_NET_EXCEPTION); } // Initialize the processor utility functions @@ -257,7 +258,7 @@ static void printHelp() << " - 3. Plus standard information." << std::endl << " - 4. Plus debugging information." << std::endl << " --port <n> : Set the default port to listen on" << std::endl; - exit(0); + exit(EXIT_NORMAL); } struct CommandLineOptions @@ -365,7 +366,7 @@ int main(int argc, char *argv[]) !chatHandler->startListen(options.port + 2, host)) { LOG_FATAL("Unable to create an ENet server host."); - return 3; + return EXIT_NET_EXCEPTION; } // Dump statistics every 10 seconds. @@ -402,5 +403,5 @@ int main(int argc, char *argv[]) chatHandler->stopListen(); deinitializeServer(); - return 0; + return EXIT_NORMAL; } |