summaryrefslogtreecommitdiff
path: root/src/login_sql
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-05 00:23:18 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-05 00:23:18 +0000
commit075bc5af11d62a9c4265942501836422194cbb6e (patch)
tree72af610618969a17795a5474861ebeb2fed12797 /src/login_sql
parent9ff9d769fa51c9ca4c85482d51eacb27522e9fe1 (diff)
downloadhercules-075bc5af11d62a9c4265942501836422194cbb6e.tar.gz
hercules-075bc5af11d62a9c4265942501836422194cbb6e.tar.bz2
hercules-075bc5af11d62a9c4265942501836422194cbb6e.tar.xz
hercules-075bc5af11d62a9c4265942501836422194cbb6e.zip
- Added inter config connection_ping_interval which specifies interval in hours at which mysql_ping's must be done on all connection handles to keep the mysql connection alive. Defaults to 0 (disabled)
- Removed login sql handle from the map server as it isn't used for anything. - Made the login sql handle on the char-sql server be used only when gm_read_method 1 is enabled. - Small fixes to npc_enable, added BL_NPC handling on status_get_sc. - Added a path_search check in map_random_dir, so that the random direction picked up doesn't goes through walls and all that. - Some changes to close-confine, status start will fail when the source is not found or it doesn't has sc-data. - pc_setoption no longer changes the character's class when mounting/dismounting, it only changes the view-class. - The peco-crash-fix from the char servers is still needed. This packet must be wrong! We likely need to sniff it. - Modified the char-txt server to modify the class of mounted characters to their non-mounted version. Added an upgrade_svn file to handle the class update on the sql tables. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5902 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql')
-rw-r--r--src/login_sql/login.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index ef5cbb7ec..d464cf2b0 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -121,6 +121,7 @@ char login_db[256] = "login";
int log_login=1; //Whether to log the logins or not. [Skotlex]
char loginlog_db[256] = "loginlog";
bool login_gm_read = true;
+int connection_ping_interval = 0;
// added to help out custom login tables, without having to recompile
// source so options are kept in the login_athena.conf or the inter_athena.conf
@@ -352,6 +353,16 @@ int e_mail_check(char *email) {
return 1;
}
+/*======================================================
+ * Does a mysql_ping to all connection handles. [Skotlex]
+ *------------------------------------------------------
+ */
+int login_sql_ping(int tid, unsigned int tick, int id, int data)
+{
+ mysql_ping(&mysql_handle);
+ return 0;
+}
+
//-----------------------------------------------------
// Read Account database - mysql db
//-----------------------------------------------------
@@ -392,6 +403,12 @@ int mmo_auth_sqldb_init(void) {
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
}
+
+ if (connection_ping_interval) {
+ add_timer_func_list(login_sql_ping, "login_sql_ping");
+ add_timer_interval(gettick()+connection_ping_interval*60*1000,
+ login_sql_ping, 0, 0, connection_ping_interval*60*1000);
+ }
return 0;
}
@@ -2172,6 +2189,9 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */
else if(strcmpi(w1,"login_server_db")==0){
strcpy(login_server_db, w2);
ShowStatus ("set login_server_db : %s\n",w2);
+ }
+ else if(strcmpi(w1,"connection_ping_interval")==0) {
+ connection_ping_interval = atoi(w2);
}
else if(strcmpi(w1,"default_codepage")==0){
strcpy(default_codepage, w2);