Browse Source

Kick all characters when the char server disconnects from the map server

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1005 54d463be-8e91-2dee-dedb-b68131a5f0ec
(no author) 20 years ago
parent
commit
48a049e7d5
2 changed files with 25 additions and 7 deletions
  1. 2 0
      Changelog.txt
  2. 23 7
      src/map/chrif.c

+ 2 - 0
Changelog.txt

@@ -1,6 +1,8 @@
 Date	Added
 
 01/27
+        * Kick all characters when the char server disconnects from the map
+          server [celest]
         * Added @changelook command for spriters to test view ID's [celest]
         * Added a check to Pneuma to prevent crashing [celest]
         * Tweaked garbage collection code after feedback from users

+ 23 - 7
src/map/chrif.c

@@ -992,6 +992,27 @@ int chrif_char_online(struct map_session_data *sd)
 	return 0;
 }
 
+/*==========================================
+ *
+ *------------------------------------------
+ */
+int chrif_disconnect_sub(struct map_session_data* sd,va_list va) {
+	clif_authfail_fd(sd->fd,1);
+	map_quit(sd);
+	return 0;
+}
+
+int chrif_disconnect(int fd) {
+	if(fd == char_fd) {
+		char_fd = -1;
+		sprintf(tmp_output,"Map Server disconnected from Char Server.\n\n");
+		ShowWarning(tmp_output);
+		clif_foreachclient(chrif_disconnect_sub);
+		chrif_connected = 0;
+	}
+	close(fd);
+	return 0;
+}
 
 /*==========================================
  *
@@ -1003,13 +1024,8 @@ int chrif_parse(int fd)
 	// only char-server can have an access to here.
 	// so, if it isn't the char-server, we disconnect the session (fd != char_fd).
 	if (fd != char_fd || session[fd]->eof) {
-		if (fd == char_fd) {
-			if (chrif_connected == 1) {
-				sprintf(tmp_output,"Map Server disconnected from Char Server.\n\n");
-				ShowWarning(tmp_output);
-				chrif_connected=0;
-			}
-			char_fd = -1;
+		if (fd == char_fd && chrif_connected == 1) {
+			chrif_disconnect (fd);
 //			check_connect_char_server(0, 0, 0, 0);
 		}
 		close(fd);