* Removed anti-freeze system for login and char
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1396 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
eeb6187dde
commit
27326acd4e
@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
|
04/04
|
||||||
|
* Removed anti-freeze system for login and char -- Shinomori's update would
|
||||||
|
be enough to keep inter connections alive [celest]
|
||||||
|
|
||||||
04/03
|
04/03
|
||||||
* integrating anti freeze system to status update [Shinomori]
|
* integrating anti freeze system to status update [Shinomori]
|
||||||
* Fixed impossible drops at 0.01% chance [Lupus]
|
* Fixed impossible drops at 0.01% chance [Lupus]
|
||||||
|
@ -166,11 +166,6 @@ chars_per_account: 0
|
|||||||
// What folder the DB files are in (item_db.txt, etc.)
|
// What folder the DB files are in (item_db.txt, etc.)
|
||||||
db_path: db
|
db_path: db
|
||||||
|
|
||||||
// Anti-freeze system enable
|
|
||||||
anti_freeze_enable: 0
|
|
||||||
// Anti-freeze system interval (in seconds)
|
|
||||||
anti_freeze_interval: 6
|
|
||||||
|
|
||||||
// Mugendai's GUI Support
|
// Mugendai's GUI Support
|
||||||
imalive_on: 0
|
imalive_on: 0
|
||||||
imalive_time: 30
|
imalive_time: 30
|
||||||
|
@ -159,11 +159,6 @@ dynamic_pass_failure_ban_how_long: 60
|
|||||||
dynamic_account_ban: 1
|
dynamic_account_ban: 1
|
||||||
dynamic_account_ban_class: 0
|
dynamic_account_ban_class: 0
|
||||||
|
|
||||||
// Anti-freeze system enable
|
|
||||||
anti_freeze_enable: 1
|
|
||||||
// Anti-freeze system interval (in seconds)
|
|
||||||
anti_freeze_interval: 30
|
|
||||||
|
|
||||||
// Enable I'm Alive?
|
// Enable I'm Alive?
|
||||||
imalive_on: 0
|
imalive_on: 0
|
||||||
// How often to display I'm Alive
|
// How often to display I'm Alive
|
||||||
|
@ -48,9 +48,6 @@ typedef long in_addr_t;
|
|||||||
|
|
||||||
struct mmo_map_server server[MAX_MAP_SERVERS];
|
struct mmo_map_server server[MAX_MAP_SERVERS];
|
||||||
int server_fd[MAX_MAP_SERVERS];
|
int server_fd[MAX_MAP_SERVERS];
|
||||||
int server_freezeflag[MAX_MAP_SERVERS]; // Map-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
int anti_freeze_enable = 0;
|
|
||||||
int ANTI_FREEZE_INTERVAL = 6;
|
|
||||||
|
|
||||||
int login_fd, char_fd;
|
int login_fd, char_fd;
|
||||||
char userid[24];
|
char userid[24];
|
||||||
@ -2094,28 +2091,6 @@ int parse_tologin(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------
|
|
||||||
// Map-server anti-freeze system
|
|
||||||
//--------------------------------
|
|
||||||
int map_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
//printf("Entering in map_anti_freeze_system function to check freeze of servers.\n");
|
|
||||||
for(i = 0; i < MAX_MAP_SERVERS; i++) {
|
|
||||||
if (server_fd[i] >= 0) {// if map-server is online
|
|
||||||
//printf("map_anti_freeze_system: server #%d, flag: %d.\n", i, server_freezeflag[i]);
|
|
||||||
if (server_freezeflag[i]-- < 1) { // Map-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
printf("Map-server anti-freeze system: char-server #%d is freezed -> disconnection.\n", i);
|
|
||||||
char_log("Map-server anti-freeze system: char-server #%d is freezed -> disconnection." RETCODE,
|
|
||||||
i);
|
|
||||||
session[server_fd[i]]->eof = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_frommap(int fd) {
|
int parse_frommap(int fd) {
|
||||||
int i, j;
|
int i, j;
|
||||||
int id;
|
int id;
|
||||||
@ -2261,8 +2236,6 @@ int parse_frommap(int fd) {
|
|||||||
if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2))
|
if (RFIFOREST(fd) < 6 || RFIFOREST(fd) < RFIFOW(fd,2))
|
||||||
return 0;
|
return 0;
|
||||||
server[id].users = RFIFOW(fd,4);
|
server[id].users = RFIFOW(fd,4);
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[id] = 5; // Map anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
// remove all previously online players of the server
|
// remove all previously online players of the server
|
||||||
for(i = 0; i < online_players_max; i++)
|
for(i = 0; i < online_players_max; i++)
|
||||||
if (online_chars[i].server == id) {
|
if (online_chars[i].server == id) {
|
||||||
@ -3015,8 +2988,6 @@ int parse_char(int fd) {
|
|||||||
WFIFOB(fd,2) = 0;
|
WFIFOB(fd,2) = 0;
|
||||||
session[fd]->func_parse = parse_frommap;
|
session[fd]->func_parse = parse_frommap;
|
||||||
server_fd[i] = fd;
|
server_fd[i] = fd;
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[i] = 5; // Map anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
server[i].ip = RFIFOL(fd,54);
|
server[i].ip = RFIFOL(fd,54);
|
||||||
server[i].port = RFIFOW(fd,58);
|
server[i].port = RFIFOW(fd,58);
|
||||||
server[i].users = 0;
|
server[i].users = 0;
|
||||||
@ -3437,12 +3408,6 @@ int char_config_read(const char *cfgName) {
|
|||||||
online_refresh_html = 1;
|
online_refresh_html = 1;
|
||||||
} else if(strcmpi(w1,"db_path")==0) {
|
} else if(strcmpi(w1,"db_path")==0) {
|
||||||
strcpy(db_path,w2);
|
strcpy(db_path,w2);
|
||||||
} else if(strcmpi(w1,"anti_freeze_enable")==0){
|
|
||||||
anti_freeze_enable = config_switch(w2);
|
|
||||||
} else if (strcmpi(w1, "anti_freeze_interval") == 0) {
|
|
||||||
ANTI_FREEZE_INTERVAL = atoi(w2);
|
|
||||||
if (ANTI_FREEZE_INTERVAL < 5)
|
|
||||||
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
|
|
||||||
} else if (strcmpi(w1, "import") == 0) {
|
} else if (strcmpi(w1, "import") == 0) {
|
||||||
char_config_read(w2);
|
char_config_read(w2);
|
||||||
} else if (strcmpi(w1, "console") == 0) {
|
} else if (strcmpi(w1, "console") == 0) {
|
||||||
@ -3583,13 +3548,6 @@ int do_init(int argc, char **argv) {
|
|||||||
if (flush_on)
|
if (flush_on)
|
||||||
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(anti_freeze_enable > 0) {
|
|
||||||
add_timer_func_list(map_anti_freeze_system, "map_anti_freeze_system");
|
|
||||||
i = add_timer_interval(gettick() + 1000, map_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000); // checks every X seconds user specifies
|
|
||||||
}
|
|
||||||
|
|
||||||
if(console) {
|
if(console) {
|
||||||
set_defaultconsoleparse(parse_console);
|
set_defaultconsoleparse(parse_console);
|
||||||
start_console();
|
start_console();
|
||||||
|
@ -78,10 +78,6 @@ char *SQL_CONF_NAME = "conf/inter_athena.conf";
|
|||||||
|
|
||||||
struct mmo_map_server server[MAX_MAP_SERVERS];
|
struct mmo_map_server server[MAX_MAP_SERVERS];
|
||||||
int server_fd[MAX_MAP_SERVERS];
|
int server_fd[MAX_MAP_SERVERS];
|
||||||
int server_freezeflag[MAX_MAP_SERVERS]; // Map-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
|
|
||||||
int anti_freeze_enable = 0;
|
|
||||||
int ANTI_FREEZE_INTERVAL = 6;
|
|
||||||
|
|
||||||
int login_fd, char_fd;
|
int login_fd, char_fd;
|
||||||
char userid[24];
|
char userid[24];
|
||||||
@ -1800,29 +1796,6 @@ int parse_tologin(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------
|
|
||||||
// Map-server anti-freeze system
|
|
||||||
//--------------------------------
|
|
||||||
int map_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 0; i < MAX_MAP_SERVERS; i++) {
|
|
||||||
if (server_fd[i] >= 0) {// if map-server is online
|
|
||||||
printf("map_anti_freeze_system: server #%d, flag: %d.\n", i, server_freezeflag[i]);
|
|
||||||
if (server_freezeflag[i]-- < 1) {// Map-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
printf("Map-server anti-freeze system: char-server #%d is frozen -> disconnection.\n", i);
|
|
||||||
session[server_fd[i]]->eof = 1;
|
|
||||||
sprintf(tmp_sql, "DELETE FROM `ragsrvinfo` WHERE `index`='%d'", server_fd[i]);
|
|
||||||
if (mysql_query(&mysql_handle, tmp_sql)) {
|
|
||||||
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_frommap(int fd) {
|
int parse_frommap(int fd) {
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
int id;
|
int id;
|
||||||
@ -1972,8 +1945,6 @@ int parse_frommap(int fd) {
|
|||||||
if (RFIFOW(fd,4) != server[id].users)
|
if (RFIFOW(fd,4) != server[id].users)
|
||||||
printf("[UserCount]: %d (Server: %d)\n", RFIFOW(fd,4), id);
|
printf("[UserCount]: %d (Server: %d)\n", RFIFOW(fd,4), id);
|
||||||
server[id].users = RFIFOW(fd,4);
|
server[id].users = RFIFOW(fd,4);
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[id] = 5; // Map anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
RFIFOSKIP(fd,RFIFOW(fd,2));
|
RFIFOSKIP(fd,RFIFOW(fd,2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2908,8 +2879,6 @@ int parse_char(int fd) {
|
|||||||
WFIFOSET(fd, 3);
|
WFIFOSET(fd, 3);
|
||||||
session[fd]->func_parse = parse_frommap;
|
session[fd]->func_parse = parse_frommap;
|
||||||
server_fd[i] = fd;
|
server_fd[i] = fd;
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[i] = 5; // Map anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
server[i].ip = RFIFOL(fd, 54);
|
server[i].ip = RFIFOL(fd, 54);
|
||||||
server[i].port = RFIFOW(fd, 58);
|
server[i].port = RFIFOW(fd, 58);
|
||||||
server[i].users = 0;
|
server[i].users = 0;
|
||||||
@ -3384,13 +3353,6 @@ int char_config_read(const char *cfgName) {
|
|||||||
check_ip_flag = config_switch(w2);
|
check_ip_flag = config_switch(w2);
|
||||||
} else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]
|
} else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]
|
||||||
char_per_account = atoi(w2);
|
char_per_account = atoi(w2);
|
||||||
// anti-freeze options [Valaris]
|
|
||||||
} else if(strcmpi(w1,"anti_freeze_enable")==0){
|
|
||||||
anti_freeze_enable = config_switch(w2);
|
|
||||||
} else if (strcmpi(w1, "anti_freeze_interval") == 0) {
|
|
||||||
ANTI_FREEZE_INTERVAL = atoi(w2);
|
|
||||||
if (ANTI_FREEZE_INTERVAL < 5)
|
|
||||||
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
|
|
||||||
} else if (strcmpi(w1, "import") == 0) {
|
} else if (strcmpi(w1, "import") == 0) {
|
||||||
char_config_read(w2);
|
char_config_read(w2);
|
||||||
} else if (strcmpi(w1, "console") == 0) {
|
} else if (strcmpi(w1, "console") == 0) {
|
||||||
@ -3494,7 +3456,6 @@ int do_init(int argc, char **argv){
|
|||||||
//printf("add interval tic (mmo_char_sync_timer)....\n");
|
//printf("add interval tic (mmo_char_sync_timer)....\n");
|
||||||
//i = add_timer_interval(gettick() + 10, mmo_char_sync_timer, 0, 0, autosave_interval);
|
//i = add_timer_interval(gettick() + 10, mmo_char_sync_timer, 0, 0, autosave_interval);
|
||||||
|
|
||||||
add_timer_func_list(map_anti_freeze_system, "map_anti_freeze_system");
|
|
||||||
//Added for Mugendais I'm Alive mod
|
//Added for Mugendais I'm Alive mod
|
||||||
if(imalive_on)
|
if(imalive_on)
|
||||||
add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
|
add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000);
|
||||||
@ -3503,11 +3464,6 @@ int do_init(int argc, char **argv){
|
|||||||
if(flush_on)
|
if(flush_on)
|
||||||
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
||||||
|
|
||||||
if(anti_freeze_enable > 0) {
|
|
||||||
add_timer_func_list(map_anti_freeze_system, "map_anti_freeze_system");
|
|
||||||
i = add_timer_interval(gettick() + 1000, map_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000); // checks every X seconds user specifies
|
|
||||||
}
|
|
||||||
|
|
||||||
read_gm_account();
|
read_gm_account();
|
||||||
|
|
||||||
if ( console ) {
|
if ( console ) {
|
||||||
|
@ -82,9 +82,6 @@ int display_parse_fromchar = 0; // 0: no, 1: yes (without packet 0x2714), 2: all
|
|||||||
|
|
||||||
struct mmo_char_server server[MAX_SERVERS];
|
struct mmo_char_server server[MAX_SERVERS];
|
||||||
int server_fd[MAX_SERVERS];
|
int server_fd[MAX_SERVERS];
|
||||||
int server_freezeflag[MAX_SERVERS]; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
int anti_freeze_enable = 0;
|
|
||||||
int ANTI_FREEZE_INTERVAL = 15;
|
|
||||||
|
|
||||||
int login_fd;
|
int login_fd;
|
||||||
|
|
||||||
@ -1260,32 +1257,6 @@ int mmo_auth(struct mmo_account* account, int fd) {
|
|||||||
return -1; // account OK
|
return -1; // account OK
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------
|
|
||||||
// Char-server anti-freeze system
|
|
||||||
//-------------------------------
|
|
||||||
int char_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
//printf("Entering in char_anti_freeze_system function to check freeze of servers.\n");
|
|
||||||
for(i = 0; i < MAX_SERVERS; i++) {
|
|
||||||
if (server_fd[i] >= 0) {// if char-server is online
|
|
||||||
//printf("char_anti_freeze_system: server #%d '%s', flag: %d.\n", i, server[i].name, server_freezeflag[i]);
|
|
||||||
if (server_freezeflag[i]-- < 1) { // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
printf("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection.\n", i, server[i].name);
|
|
||||||
login_log("Char-server anti-freeze system: char-server #%d '%s' is freezed -> disconnection." RETCODE,
|
|
||||||
i, server[i].name);
|
|
||||||
session[server_fd[i]]->eof = 1;
|
|
||||||
} else {
|
|
||||||
// send alive packet to check connection
|
|
||||||
WFIFOW(server_fd[i],0) = 0x2718;
|
|
||||||
WFIFOSET(server_fd[i],2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
// Packet parsing for char-servers
|
// Packet parsing for char-servers
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
@ -1392,9 +1363,6 @@ int parse_fromchar(int fd) {
|
|||||||
return 0;
|
return 0;
|
||||||
//printf("parse_fromchar: Receiving of the users number of the server '%s': %d\n", server[id].name, RFIFOL(fd,2));
|
//printf("parse_fromchar: Receiving of the users number of the server '%s': %d\n", server[id].name, RFIFOL(fd,2));
|
||||||
server[id].users = RFIFOL(fd,2);
|
server[id].users = RFIFOL(fd,2);
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
|
|
||||||
// send some answer
|
// send some answer
|
||||||
WFIFOW(fd,0) = 0x2718;
|
WFIFOW(fd,0) = 0x2718;
|
||||||
WFIFOSET(fd,2);
|
WFIFOSET(fd,2);
|
||||||
@ -3060,8 +3028,6 @@ int parse_login(int fd) {
|
|||||||
server[account.account_id].maintenance = RFIFOW(fd,82);
|
server[account.account_id].maintenance = RFIFOW(fd,82);
|
||||||
server[account.account_id].new_ = RFIFOW(fd,84);
|
server[account.account_id].new_ = RFIFOW(fd,84);
|
||||||
server_fd[account.account_id] = fd;
|
server_fd[account.account_id] = fd;
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
WFIFOW(fd,0) = 0x2711;
|
WFIFOW(fd,0) = 0x2711;
|
||||||
WFIFOB(fd,2) = 0;
|
WFIFOB(fd,2) = 0;
|
||||||
WFIFOSET(fd,3);
|
WFIFOSET(fd,3);
|
||||||
@ -3083,10 +3049,8 @@ int parse_login(int fd) {
|
|||||||
if (server_fd[account.account_id] != -1) {
|
if (server_fd[account.account_id] != -1) {
|
||||||
printf("Connection of the char-server '%s' REFUSED - already connected (account: %ld-%s, pass: %s, ip: %s)\n",
|
printf("Connection of the char-server '%s' REFUSED - already connected (account: %ld-%s, pass: %s, ip: %s)\n",
|
||||||
server_name, account.account_id, account.userid, account.passwd, ip);
|
server_name, account.account_id, account.userid, account.passwd, ip);
|
||||||
printf("You must probably wait that the freeze system detect the disconnection.\n");
|
|
||||||
login_log("Connexion of the char-server '%s' REFUSED - already connected (account: %ld-%s, pass: %s, ip: %s)" RETCODE,
|
login_log("Connexion of the char-server '%s' REFUSED - already connected (account: %ld-%s, pass: %s, ip: %s)" RETCODE,
|
||||||
server_name, account.account_id, account.userid, account.passwd, ip);
|
server_name, account.account_id, account.userid, account.passwd, ip);
|
||||||
login_log("You must probably wait that the freeze system detect the disconnection." RETCODE);
|
|
||||||
} else {
|
} else {
|
||||||
printf("Connection of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s).\n", server_name, account.userid, account.passwd, ip);
|
printf("Connection of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s).\n", server_name, account.userid, account.passwd, ip);
|
||||||
login_log("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)" RETCODE,
|
login_log("Connexion of the char-server '%s' REFUSED (account: %s, pass: %s, ip: %s)" RETCODE,
|
||||||
@ -3556,13 +3520,6 @@ int login_config_read(const char *cfgName) {
|
|||||||
dynamic_pass_failure_ban_how_many = atoi(w2);
|
dynamic_pass_failure_ban_how_many = atoi(w2);
|
||||||
} else if (strcmpi(w1, "dynamic_pass_failure_ban_how_long") == 0) {
|
} else if (strcmpi(w1, "dynamic_pass_failure_ban_how_long") == 0) {
|
||||||
dynamic_pass_failure_ban_how_long = atoi(w2);
|
dynamic_pass_failure_ban_how_long = atoi(w2);
|
||||||
// Anti-Freeze
|
|
||||||
} else if(strcmpi(w1,"anti_freeze_enable")==0){
|
|
||||||
anti_freeze_enable = config_switch(w2);
|
|
||||||
} else if (strcmpi(w1, "anti_freeze_interval") == 0) {
|
|
||||||
ANTI_FREEZE_INTERVAL = atoi(w2);
|
|
||||||
if (ANTI_FREEZE_INTERVAL < 5)
|
|
||||||
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
|
|
||||||
} else if (strcmpi(w1, "import") == 0) {
|
} else if (strcmpi(w1, "import") == 0) {
|
||||||
login_config_read(w2);
|
login_config_read(w2);
|
||||||
} else if(strcmpi(w1,"imalive_on")==0) { //Added by Mugendai for I'm Alive mod
|
} else if(strcmpi(w1,"imalive_on")==0) { //Added by Mugendai for I'm Alive mod
|
||||||
@ -3980,10 +3937,6 @@ int do_init(int argc, char **argv) {
|
|||||||
//login_fd = make_listen_port(login_port);
|
//login_fd = make_listen_port(login_port);
|
||||||
login_fd = make_listen_bind(bind_ip,login_port);
|
login_fd = make_listen_bind(bind_ip,login_port);
|
||||||
|
|
||||||
if(anti_freeze_enable > 0) {
|
|
||||||
add_timer_func_list(char_anti_freeze_system, "char_anti_freeze_system");
|
|
||||||
i = add_timer_interval(gettick() + 1000, char_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000);
|
|
||||||
}
|
|
||||||
add_timer_func_list(check_auth_sync, "check_auth_sync");
|
add_timer_func_list(check_auth_sync, "check_auth_sync");
|
||||||
i = add_timer_interval(gettick() + 60000, check_auth_sync, 0, 0, 60000); // every 60 sec we check if we must save accounts file (only if necessary to save)
|
i = add_timer_interval(gettick() + 60000, check_auth_sync, 0, 0, 60000); // every 60 sec we check if we must save accounts file (only if necessary to save)
|
||||||
|
|
||||||
|
@ -79,9 +79,6 @@ int subnetmaski[4]; // Subnetmask added by kashy
|
|||||||
|
|
||||||
struct mmo_char_server server[MAX_SERVERS];
|
struct mmo_char_server server[MAX_SERVERS];
|
||||||
int server_fd[MAX_SERVERS];
|
int server_fd[MAX_SERVERS];
|
||||||
int server_freezeflag[MAX_SERVERS]; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
int anti_freeze_enable = 0;
|
|
||||||
int ANTI_FREEZE_INTERVAL = 15;
|
|
||||||
|
|
||||||
int login_fd;
|
int login_fd;
|
||||||
|
|
||||||
@ -648,28 +645,6 @@ int charif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------
|
|
||||||
// Char-server anti-freeze system
|
|
||||||
//--------------------------------
|
|
||||||
int char_anti_freeze_system(int tid, unsigned int tick, int id, int data) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i = 0; i < MAX_SERVERS; i++) {
|
|
||||||
if (server_fd[i] >= 0) {// if char-server is online
|
|
||||||
// printf("char_anti_freeze_system: server #%d '%s', flag: %d.\n", i, server[i].name, server_freezeflag[i]);
|
|
||||||
if (server_freezeflag[i]-- < 1) {// Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
session[server_fd[i]]->eof = 1;
|
|
||||||
} else {
|
|
||||||
// send alive packet to check connection
|
|
||||||
WFIFOW(server_fd[i],0) = 0x2718;
|
|
||||||
WFIFOSET(server_fd[i],2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// char-server packet parse
|
// char-server packet parse
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -800,9 +775,6 @@ int parse_fromchar(int fd){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[id] = 5; // Char anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
|
|
||||||
// send some answer
|
// send some answer
|
||||||
WFIFOW(fd,0) = 0x2718;
|
WFIFOW(fd,0) = 0x2718;
|
||||||
WFIFOSET(fd,2);
|
WFIFOSET(fd,2);
|
||||||
@ -1454,8 +1426,6 @@ int parse_login(int fd) {
|
|||||||
server[account.account_id].maintenance=RFIFOW(fd,82);
|
server[account.account_id].maintenance=RFIFOW(fd,82);
|
||||||
server[account.account_id].new_=RFIFOW(fd,84);
|
server[account.account_id].new_=RFIFOW(fd,84);
|
||||||
server_fd[account.account_id]=fd;
|
server_fd[account.account_id]=fd;
|
||||||
if(anti_freeze_enable)
|
|
||||||
server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
|
|
||||||
sprintf(tmpsql,"DELETE FROM `sstatus` WHERE `index`='%ld'", account.account_id);
|
sprintf(tmpsql,"DELETE FROM `sstatus` WHERE `index`='%ld'", account.account_id);
|
||||||
//query
|
//query
|
||||||
if(mysql_query(&mysql_handle, tmpsql)) {
|
if(mysql_query(&mysql_handle, tmpsql)) {
|
||||||
@ -1680,14 +1650,6 @@ int login_config_read(const char *cfgName){
|
|||||||
dynamic_pass_failure_ban_how_long=atoi(w2);
|
dynamic_pass_failure_ban_how_long=atoi(w2);
|
||||||
printf ("set dynamic_pass_failure_ban_how_long : %d\n",dynamic_pass_failure_ban_how_long);
|
printf ("set dynamic_pass_failure_ban_how_long : %d\n",dynamic_pass_failure_ban_how_long);
|
||||||
}
|
}
|
||||||
else if(strcmpi(w1,"anti_freeze_enable")==0){
|
|
||||||
anti_freeze_enable = config_switch(w2);
|
|
||||||
}
|
|
||||||
else if (strcmpi(w1, "anti_freeze_interval") == 0) {
|
|
||||||
ANTI_FREEZE_INTERVAL = atoi(w2);
|
|
||||||
if (ANTI_FREEZE_INTERVAL < 5)
|
|
||||||
ANTI_FREEZE_INTERVAL = 5; // minimum 5 seconds
|
|
||||||
}
|
|
||||||
else if (strcmpi(w1, "import") == 0) {
|
else if (strcmpi(w1, "import") == 0) {
|
||||||
login_config_read(w2);
|
login_config_read(w2);
|
||||||
} else if(strcmpi(w1,"imalive_on")==0) { //Added by Mugendai for I'm Alive mod
|
} else if(strcmpi(w1,"imalive_on")==0) { //Added by Mugendai for I'm Alive mod
|
||||||
@ -1916,12 +1878,6 @@ int do_init(int argc,char **argv){
|
|||||||
if(flush_on)
|
if(flush_on)
|
||||||
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
add_timer_interval(gettick()+10, flush_timer,0,0,flush_time);
|
||||||
|
|
||||||
|
|
||||||
if(anti_freeze_enable > 0) {
|
|
||||||
add_timer_func_list(char_anti_freeze_system, "char_anti_freeze_system");
|
|
||||||
i = add_timer_interval(gettick()+1000, char_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ban deleter timer - 1 minute term
|
// ban deleter timer - 1 minute term
|
||||||
printf("add interval tic (ip_ban_check)....\n");
|
printf("add interval tic (ip_ban_check)....\n");
|
||||||
i=add_timer_interval(gettick()+10, ip_ban_check,0,0,60*1000);
|
i=add_timer_interval(gettick()+10, ip_ban_check,0,0,60*1000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user