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://svn.code.sf.net/p/rathena/svn/trunk@12520 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2008-04-07 13:49:13 +00:00
parent 8509bea301
commit 255f0fe3fc
5 changed files with 12 additions and 52 deletions

View File

@ -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 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) // 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_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; return 0;
} }
@ -912,7 +912,7 @@ int chrif_accountdeletion(int fd)
if (sd != NULL) { if (sd != NULL) {
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters 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_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 { } else {
if (sd != NULL) if (sd != NULL)
@ -967,7 +967,7 @@ int chrif_accountban(int fd)
clif_displaymessage(sd->fd, tmpstr); 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; return 0;
} }

View File

@ -535,7 +535,7 @@ int clif_authfail_fd(int fd, int type)
WFIFOW(fd,0) = 0x81; WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = type; WFIFOB(fd,2) = type;
WFIFOSET(fd,packet_len(0x81)); WFIFOSET(fd,packet_len(0x81));
clif_setwaitclose(fd); set_eof(fd);
return 0; 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)); 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Ûžš * 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. //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); 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; return false;
} }
@ -7692,7 +7654,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd)
WFIFOW(fd,0) = 0x6a; WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = 5; // Your Game's EXE file is not the latest version WFIFOB(fd,2) = 5; // Your Game's EXE file is not the latest version
WFIFOSET(fd,packet_len(0x6a)); WFIFOSET(fd,packet_len(0x6a));
clif_setwaitclose(fd); set_eof(fd);
return; return;
} }
@ -7704,7 +7666,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd)
WFIFOW(fd,0) = 0x6a; WFIFOW(fd,0) = 0x6a;
WFIFOB(fd,2) = 3; // Rejected by server WFIFOB(fd,2) = 3; // Rejected by server
WFIFOSET(fd,packet_len(0x6a)); WFIFOSET(fd,packet_len(0x6a));
clif_setwaitclose(fd); set_eof(fd);
return; 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] && 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) (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
) { ) {
clif_setwaitclose(fd); set_eof(fd);
WFIFOW(fd,2)=0; WFIFOW(fd,2)=0;
} else { } else {
WFIFOW(fd,2)=1; WFIFOW(fd,2)=1;
@ -12215,7 +12177,7 @@ int clif_parse(int fd)
WFIFOB(fd,2) = 3; // Rejected from Server WFIFOB(fd,2) = 3; // Rejected from Server
WFIFOSET(fd,packet_len(0x6a)); WFIFOSET(fd,packet_len(0x6a));
RFIFOSKIP(fd, RFIFOREST(fd)); RFIFOSKIP(fd, RFIFOREST(fd));
clif_setwaitclose(fd); set_eof(fd);
return 0; return 0;
} }
} }
@ -12730,7 +12692,6 @@ int do_init_clif(void)
exit(EXIT_FAILURE); 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_clearunit_delayed_sub, "clif_clearunit_delayed_sub");
add_timer_func_list(clif_delayquit, "clif_delayquit"); add_timer_func_list(clif_delayquit, "clif_delayquit");
return 0; return 0;

View File

@ -91,7 +91,6 @@ void clif_setport(uint16 port);
uint32 clif_getip(void); uint32 clif_getip(void);
uint32 clif_refresh_ip(void); uint32 clif_refresh_ip(void);
uint16 clif_getport(void); uint16 clif_getport(void);
void clif_setwaitclose(int);
int clif_authok(struct map_session_data *); int clif_authok(struct map_session_data *);
int clif_authfail_fd(int fd,int type); int clif_authfail_fd(int fd,int type);

View File

@ -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 //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 //have no recourse but to kick them out so their inventory will refresh
//correctly on relog. [Skotlex] //correctly on relog. [Skotlex]
if (i) clif_setwaitclose(sd->fd); if (i) set_eof(sd->fd);
return 1; return 1;
} }
return 0; return 0;

View File

@ -200,13 +200,13 @@ int impossible_trade_check(struct map_session_data *sd)
// if we block people // if we block people
if (battle_config.ban_hack_trade < 0) { 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 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 // message about the ban
sprintf(message_to_gm, msg_txt(540)); // This player has been definitivly blocked. sprintf(message_to_gm, msg_txt(540)); // This player has been definitivly blocked.
// if we ban people // if we ban people
} else if (battle_config.ban_hack_trade > 0) { } 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) 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 // 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). sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s).
} else } else