From 85bdc1dc6c13036984310f39428c82968ecffba7 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 10 Jul 2006 19:41:25 +0000 Subject: - Added login-char packet 0x2737. Sets all characters offline (login-server side). - Cleaned up char server "set all offline" implementation to remove only characters from the map-server from which the packet was invoked. It will also now correctly kick/set-character offline from the map-server if they are connected. - Cleaned up the char-sql reconnect code. It no longer sets everyone to offline. - Removed setting "kick_on_disconnect", servers will no longer kick characters out when there's a disconnection. Instead, it'll use the most logical approach: Set characters into a "lost" state when there's a disconnection, on reconnect, resent the list of online-characters, do a sync, and let the difference be characters to be removed. Also, the map-server won't release character data until it's saved and the ack returns from the char-server to prevent data loss (all this data is resent on reconnect for saving anyway). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7600 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chrif.c | 26 +++----------------------- src/map/clif.c | 7 ++++--- src/map/map.c | 5 +---- src/map/map.h | 1 - 4 files changed, 8 insertions(+), 31 deletions(-) (limited to 'src/map') diff --git a/src/map/chrif.c b/src/map/chrif.c index 9e98b5eb9..3cbce9849 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -454,7 +454,7 @@ int chrif_scdata_request(int account_id, int char_id) #endif chrif_check(-1); - WFIFOHEAD(char_fd, 10); + WFIFOHEAD(char_fd, 10); WFIFOW(char_fd, 0) = 0x2afc; WFIFOL(char_fd, 2) = account_id; WFIFOL(char_fd, 6) = char_id; @@ -1344,7 +1344,7 @@ int chrif_char_offline(struct map_session_data *sd) { chrif_check(-1); - WFIFOHEAD(char_fd, 10); + WFIFOHEAD(char_fd, 10); WFIFOW(char_fd,0) = 0x2b17; WFIFOL(char_fd,2) = sd->status.char_id; WFIFOL(char_fd,6) = sd->status.account_id; @@ -1374,7 +1374,7 @@ int chrif_flush_fifo(void) { int chrif_char_reset_offline(void) { chrif_check(-1); - WFIFOHEAD(char_fd, 2); + WFIFOHEAD(char_fd, 2); WFIFOW(char_fd,0) = 0x2b18; WFIFOSET(char_fd,2); @@ -1399,35 +1399,15 @@ int chrif_char_online(struct map_session_data *sd) return 0; } -/*========================================== - * - *------------------------------------------ - */ -int chrif_disconnect_sub(struct map_session_data* sd,va_list va) { - if (sd->fd) - clif_authfail_fd(sd->fd,1); - else - map_quit(sd); - return 0; -} - int chrif_disconnect(int fd) { if(fd == char_fd) { char_fd = 0; ShowWarning("Map Server disconnected from Char Server.\n\n"); - if (kick_on_disconnect) - clif_foreachclient(chrif_disconnect_sub); chrif_connected = 0; other_mapserver_count=0; //Reset counter. We receive ALL maps from all map-servers on reconnect. map_eraseallipport(); - // 倉庫キャッシュを消す - if (kick_on_disconnect) - { //Do not clean the storage if players are gonna be left inside. [Skotlex] - do_final_storage(); - do_init_storage(); - } //Attempt to reconnect in a second. [Skotlex] add_timer(gettick() + 1000, check_connect_char_server, 0, 0); } diff --git a/src/map/clif.c b/src/map/clif.c index 477180fc2..59b6df8e1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11390,9 +11390,9 @@ int clif_parse(int fd) { } sd = (struct map_session_data*)session[fd]->session_data; - - // 接続が切れてるので後始末 - if (!chrif_isconnect() && kick_on_disconnect) +/* This behaviour has been deprecated due to actually causing trouble instead + * of helping against exploits ~.~ [Skotlex] + if (!chrif_isconnect()) { ShowInfo("Closing session #%d (Not connected to Char server)\n", fd); if (sd && sd->state.auth) @@ -11400,6 +11400,7 @@ int clif_parse(int fd) { do_close(fd); return 0; } else + */ if (session[fd]->eof) { if (sd && sd->state.autotrade) { //Disassociate character from the socket connection. diff --git a/src/map/map.c b/src/map/map.c index ec9105bba..fb1ee84ec 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -172,7 +172,6 @@ int save_settings = 0xFFFF; int charsave_method = 0; //Default 'OLD' Save method (SQL ONLY!) [Sirius] int agit_flag = 0; int night_flag = 0; // 0=day, 1=night [Yor] -int kick_on_disconnect = 1; struct charid2nick { char nick[NAME_LENGTH]; @@ -3383,9 +3382,7 @@ int inter_config_read(char *cfgName) i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2); if(i!=2) continue; - if(strcmpi(w1,"kick_on_disconnect")==0){ - kick_on_disconnect = battle_config_switch(w2); - } else if(strcmpi(w1,"party_share_level")==0){ + if(strcmpi(w1,"party_share_level")==0){ party_share_level = battle_config_switch(w2); } else if(strcmpi(w1,"lowest_gm_level")==0){ lowest_gm_level = atoi(w2); diff --git a/src/map/map.h b/src/map/map.h index c247d0a16..f2faad936 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1247,7 +1247,6 @@ extern int autosave_interval; extern int save_settings; extern int agit_flag; extern int night_flag; // 0=day, 1=night [Yor] -extern int kick_on_disconnect; //To allow inter-server reconnections without kicking players out [Skotlex] extern int enable_spy; //Determines if @spy commands are active. extern char db_path[256]; -- cgit v1.2.3-70-g09d2