From 58862dd12a898cbf75f099a2613ed6540325ce90 Mon Sep 17 00:00:00 2001 From: ultramage Date: Mon, 7 Apr 2008 13:49:13 +0000 Subject: Removed the 'wait close' timer that closed a session's socket after 5 seconds. This was causing random disconnects when logging in. (bugreport:1330) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12520 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chrif.c | 6 +++--- src/map/clif.c | 51 ++++++--------------------------------------------- src/map/clif.h | 1 - src/map/npc.c | 2 +- src/map/trade.c | 4 ++-- 5 files changed, 12 insertions(+), 52 deletions(-) diff --git a/src/map/chrif.c b/src/map/chrif.c index 615755fd0..27005e8f0 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -830,7 +830,7 @@ int chrif_changedsex(int fd) sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters // do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it) clif_displaymessage(sd->fd, "Your sex has been changed (need disconnection by the server)..."); - clif_setwaitclose(sd->fd); // forced to disconnect for the change + set_eof(sd->fd); // forced to disconnect for the change } return 0; } @@ -912,7 +912,7 @@ int chrif_accountdeletion(int fd) if (sd != NULL) { sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters clif_displaymessage(sd->fd, "Your account has been deleted (disconnection)..."); - clif_setwaitclose(sd->fd); // forced to disconnect for the change + set_eof(sd->fd); // forced to disconnect for the change } } else { if (sd != NULL) @@ -967,7 +967,7 @@ int chrif_accountban(int fd) clif_displaymessage(sd->fd, tmpstr); } - clif_setwaitclose(sd->fd); // forced to disconnect for the change + set_eof(sd->fd); // forced to disconnect for the change return 0; } diff --git a/src/map/clif.c b/src/map/clif.c index 711f0d50b..56a46a015 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -535,7 +535,7 @@ int clif_authfail_fd(int fd, int type) WFIFOW(fd,0) = 0x81; WFIFOB(fd,2) = type; WFIFOSET(fd,packet_len(0x81)); - clif_setwaitclose(fd); + set_eof(fd); return 0; } @@ -1316,31 +1316,6 @@ void clif_quitsave(int fd,struct map_session_data *sd) } } -/*========================================== - * - *------------------------------------------*/ -static int clif_waitclose(int tid, unsigned int tick, int id, int data) -{ - if (session[id] && session[id]->func_parse == clif_parse) //Avoid disconnecting non-players, as pointed out by End of Exam [Skotlex] - set_eof(id); - - return 0; -} - -/*========================================== - * - *------------------------------------------*/ -void clif_setwaitclose(int fd) -{ - - // if player is not already in the game (double connection probably) - if (session[fd]->session_data == NULL) { - // limited timer, just to send information. - add_timer(gettick() + 1000, clif_waitclose, fd, 0); - } else - add_timer(gettick() + 5000, clif_waitclose, fd, 0); -} - /*========================================== * *------------------------------------------*/ @@ -6875,19 +6850,6 @@ void clif_GM_silence(struct map_session_data* sd, struct map_session_data* tsd, WFIFOSET(fd, packet_len(0x14b)); } -/*========================================== - * - *------------------------------------------*/ -int clif_timedout(struct map_session_data *sd) -{ - nullpo_retr(0, sd); - - ShowInfo("%sCharacter with Account ID '"CL_WHITE"%d"CL_RESET"' timed out.\n", (pc_isGM(sd))?"GM ":"", sd->bl.id); - clif_authfail_fd(sd->fd,3); // Even if player is not on we still send anyway - clif_setwaitclose(sd->fd); // Set session to EOF - return 0; -} - /*========================================== * Wis‹‘”Ϋ‹–‰Β‰ž“š *------------------------------------------*/ @@ -7526,7 +7488,7 @@ static bool clif_process_message(struct map_session_data* sd, int format, char** { //Hacked message, or infamous "client desynch" issue where they pick one char while loading another. ShowWarning("clif_process_message: Player '%s' sent a message using an incorrect name! Forcing a relog...\n", sd->status.name); - clif_setwaitclose(fd); // Just kick them out to correct it. + set_eof(fd); // Just kick them out to correct it. return false; } @@ -7692,7 +7654,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) WFIFOW(fd,0) = 0x6a; WFIFOB(fd,2) = 5; // Your Game's EXE file is not the latest version WFIFOSET(fd,packet_len(0x6a)); - clif_setwaitclose(fd); + set_eof(fd); return; } @@ -7704,7 +7666,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) WFIFOW(fd,0) = 0x6a; WFIFOB(fd,2) = 3; // Rejected by server WFIFOSET(fd,packet_len(0x6a)); - clif_setwaitclose(fd); + set_eof(fd); return; } @@ -8097,7 +8059,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd) if (!sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { - clif_setwaitclose(fd); + set_eof(fd); WFIFOW(fd,2)=0; } else { WFIFOW(fd,2)=1; @@ -12215,7 +12177,7 @@ int clif_parse(int fd) WFIFOB(fd,2) = 3; // Rejected from Server WFIFOSET(fd,packet_len(0x6a)); RFIFOSKIP(fd, RFIFOREST(fd)); - clif_setwaitclose(fd); + set_eof(fd); return 0; } } @@ -12730,7 +12692,6 @@ int do_init_clif(void) exit(EXIT_FAILURE); } - add_timer_func_list(clif_waitclose, "clif_waitclose"); add_timer_func_list(clif_clearunit_delayed_sub, "clif_clearunit_delayed_sub"); add_timer_func_list(clif_delayquit, "clif_delayquit"); return 0; diff --git a/src/map/clif.h b/src/map/clif.h index dafc2fcba..0c0e9b04d 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -91,7 +91,6 @@ void clif_setport(uint16 port); uint32 clif_getip(void); uint32 clif_refresh_ip(void); uint16 clif_getport(void); -void clif_setwaitclose(int); int clif_authok(struct map_session_data *); int clif_authfail_fd(int fd,int type); diff --git a/src/map/npc.c b/src/map/npc.c index 98a03d2cd..78a7390cd 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1266,7 +1266,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list) //any item as deleted even though a few were sold. In such a case, we //have no recourse but to kick them out so their inventory will refresh //correctly on relog. [Skotlex] - if (i) clif_setwaitclose(sd->fd); + if (i) set_eof(sd->fd); return 1; } return 0; diff --git a/src/map/trade.c b/src/map/trade.c index f65827f2f..e94bb5a0d 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -200,13 +200,13 @@ int impossible_trade_check(struct map_session_data *sd) // if we block people if (battle_config.ban_hack_trade < 0) { chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block - clif_setwaitclose(sd->fd); // forced to disconnect because of the hack + set_eof(sd->fd); // forced to disconnect because of the hack // message about the ban sprintf(message_to_gm, msg_txt(540)); // This player has been definitivly blocked. // if we ban people } else if (battle_config.ban_hack_trade > 0) { chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second) - clif_setwaitclose(sd->fd); // forced to disconnect because of the hack + set_eof(sd->fd); // forced to disconnect because of the hack // message about the ban sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s). } else -- cgit v1.2.3-70-g09d2