summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-02-16 19:30:21 -0200
committershennetsind <ind@henn.et>2013-02-16 19:30:21 -0200
commitd8280002947c462b0bb731c12c20efc301ccb891 (patch)
tree28e1b539c6df1886f8c3d234dc31361fb1a34ef7 /src
parentd7ce0c1ce8c4d9118d1340e48424ad9deae0da09 (diff)
downloadhercules-d8280002947c462b0bb731c12c20efc301ccb891.tar.gz
hercules-d8280002947c462b0bb731c12c20efc301ccb891.tar.bz2
hercules-d8280002947c462b0bb731c12c20efc301ccb891.tar.xz
hercules-d8280002947c462b0bb731c12c20efc301ccb891.zip
Minor changes; check description
Login and Char servers will now exit when failing to bind to the port (as map server has always done). Moved Sql_HerculesUpdateCheck() to be run before "server is 'ready' " thing for layout-purposes. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c12
-rw-r--r--src/login/login.c19
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/map.c4
4 files changed, 22 insertions, 15 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 8b75f6394..b6c88623c 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -4830,10 +4830,16 @@ int do_init(int argc, char **argv)
Sql_ShowDebug(sql_handle);
set_defaultparse(parse_char);
- char_fd = make_listen_bind(bind_ip, char_port);
- ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port);
-
+
+ if( (char_fd = make_listen_bind(bind_ip,char_port)) == -1 ) {
+ ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",char_port);
+ exit(EXIT_FAILURE);
+ }
+
Sql_HerculesUpdateCheck(sql_handle);
+
+ ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port);
+
if( runflag != CORE_ST_STOP )
{
shutdown_callback = do_shutdown;
diff --git a/src/login/login.c b/src/login/login.c
index c7e250040..984326532 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1863,24 +1863,25 @@ int do_init(int argc, char** argv)
}
}
- if( login_config.console )
- {
+ if( login_config.console ) {
//##TODO invoke a CONSOLE_START plugin event
}
- // server port open & binding
- login_fd = make_listen_bind(login_config.login_ip, login_config.login_port);
+ // server port open & binding
+ if( (login_fd = make_listen_bind(login_config.login_ip,login_config.login_port)) == -1 ) {
+ ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",login_config.login_port);
+ exit(EXIT_FAILURE);
+ }
- if( runflag != CORE_ST_STOP )
- {
+ if( runflag != CORE_ST_STOP ) {
shutdown_callback = do_shutdown;
runflag = LOGINSERVER_ST_RUNNING;
}
- ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port);
- login_log(0, "login server", 100, "login server started");
-
account_db_sql_up(accounts);
+ ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port);
+ login_log(0, "login server", 100, "login server started");
+
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 6d9e57bd2..7b4025b9d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17119,7 +17119,7 @@ int do_init_clif(void) {
set_defaultparse(clif_parse);
if( make_listen_bind(bind_ip,map_port) == -1 ) {
- ShowFatalError("can't bind game port\n");
+ ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",map_port);
exit(EXIT_FAILURE);
}
diff --git a/src/map/map.c b/src/map/map.c
index dde922f39..901234687 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3985,10 +3985,10 @@ int do_init(int argc, char *argv[])
if (battle_config.pk_mode)
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
- ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port);
-
Sql_HerculesUpdateCheck(mmysql_handle);
+ ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port);
+
if( runflag != CORE_ST_STOP )
{
shutdown_callback = do_shutdown;