Browse Source

A few bug fixes

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@412 54d463be-8e91-2dee-dedb-b68131a5f0ec
amber 20 năm trước cách đây
mục cha
commit
c4c0532ffa
8 tập tin đã thay đổi với 43 bổ sung579 xóa
  1. 8 0
      Changelog.txt
  2. 4 0
      Dev/bugs.txt
  3. 0 569
      conf-tmpl/atcommand_athena.conf.orig
  4. 11 7
      src/char_sql/char.c
  5. 12 1
      src/common/socket.c
  6. 2 0
      src/common/socket.h
  7. 1 1
      src/login_sql/login.c
  8. 5 1
      src/map/map.c

+ 8 - 0
Changelog.txt

@@ -1,5 +1,13 @@
 Date	Added
 11/28
+	* Fixed a crash in login_sql/login.c [MouseJstr]
+	* made common/socket.c more crash resistant [MouseJstr]
+	* Added flush_fifos to socket.c so that we can make sure everything
+	  has been sent before we shut the process down [MouseJstr]
+	* Modified src/char_sql/char.c to flush fifos on exit [MouseJstr]
+	* Fixed a crash in src/map/map.c shutdown where it would
+	  use the char_fd session after it was alrady cleaned up [MouseJstr]
+	* removed conf-templ/atcommand_athena.conf.orig [MouseJstr]
 	* removed a USE from sql-files/main.sql that should not be there [MouseJstr]
 	* Changed MSG_INFO color to bright white, since bright blue want so bright... [MC Cameri]
 	* Made Map Removed: %d string be displayed only if there were maps removed. [MC Cameri]

+ 4 - 0
Dev/bugs.txt

@@ -84,3 +84,7 @@ Problem:        Changing email and Broadcast both use the same packets / Packet
 Notes:          Refer to char.c line 2272 and line 2416, intif.c line 107, chrif.c line 377
 Assigned:       N/A
 Progress:       0%
+
+Problem:	Sanctuary heal emp during WoE?
+Assigned:       N/A
+Progress:       0%

+ 0 - 569
conf-tmpl/atcommand_athena.conf.orig

@@ -1,569 +0,0 @@
-// Athena atcommand Configuration file.
-// Translated by Peter Kieser <pfak@telus.net>
-
-// Set here the symbol that you want to use for your commands
-// Only 1 character is get (default is '@'). You can set any character,
-// except control-character (0x00-0x1f), '%' (party chat speaking) and '/' (standard ragnarok GM commands)
-// With default character, all commands begin by a '@': <example> @revive
-command_symbol: @
-
-
-// Sets the level of the users that can use the GM commands.
-// <command name>: level
-// When battle_athena.conf has atcommand_gm_only set to no,
-// normal players (gm level 0) can use GM commands if you set 0 to the command level.
-// Max GM level is 99. If you want forbid a command to all people, set it with level 100.
-
-// Default values are set to define different GM levels like follow:
-// 0: normal player
-//    -> no special advantage (only @time to know time and if at_command_gm_only is disabled)
-// 1: Super player
-//    -> some (very) little advantages: storage, petrename, etc...
-// 10: Super player+
-//    -> same of Super player with !go (very super player)
-// 20: Mediator
-//    -> it's a GM that only need to know people, and move to their to speak with them (they can access to any command about wisps)
-// 40: Sub-GM
-//    -> This GM can help a GM, and can not create item or zeny or modify a character (can have some information commands)
-// 50: Sub-GM+
-//    -> This GM can change some non-important things on a character
-// 60: GM
-//    -> can do almost anything (excep administration, and mass commands)
-//       GM is the first level where we can modify a character with important value, create items or create zenys
-// 80: GM Chief
-//    -> can do anything, except administration commands
-// 99: Administrator
-//    -> can do anything!
-
-
-//--------------------------
-// 0: normal player commands
-
-// Give server time. (6 same commands)
-time: 0
-date: 0
-server_date: 0
-serverdate: 0
-server_time: 0
-servertime: 0
-
-// Display your ignore list (people from which you ignore wisps)
-ignorelist: 0
-
-// To change your (own) email (characters protection)
-// note: this command doesn't check email itself, but check structure of the email (xxx@xxx)
-//       if you want be sure of each e-mail disable this option (value: 100)
-email: 0
-
-// To become GM (need password; password is set in login_athena.conf).
-// special!: only a non-GM (player with gm level 0) need to have this command.
-//           if you change the value, be sure of what you do!
-// To be able to create a gm with @gm, you must:
-// - give a level to level_new_gm (parameter of login_athena.conf) (not 0)
-// - enable to level 0 the @gm command (atcommand_athena.conf) (default 100) - Only level 0 can give access to this command
-// - enable gm commands to normal player (battle_athena.conf, atcommand_gm_only parameter)
-// - and normal player must give correct password when he use the @gm command (gm_pass paramter in login_athena.conf)
-gm: 100
-
-
-//-------------------------
-// 1: Super player commands
-
-// Suicide your character.
-die: 1
-
-// Enables you to rename your pet.
-petrename: 1
-
-party: 1
-
-// Brings up your personal storage wherever you are.
-storage: 1
-
-// Locate someone on a map, returns your coordinates if the person isn't on.
-where: 1
-
-
-//---------------------------
-// 10: Super player+ commands
-
-// Spawns you to set points in major cities.
-go: 10
-
-
-//----------------------
-// 20: Mediator commands
-
-// Displays helpfile in Athena base directory (2 same commands).
-help: 20
-h: 20
-
-// Warp yourself to a person (3 same commands + /shift).
-jumpto: 20
-goto: 20
-warpto: 20
-
-// follow a player (including warping to them)
-follow: 20
-
-// Disconnects a user from the server (1 command + right click menu for GM "(name) force to quit").
-kick: 20
-
-// Changes your apperance.
-model: 20
-
-// To get a peco to (un)ride
-mountpeco: 20
-
-// Returns list of logged in characters with their position (2 same commands).
-who: 20
-whois: 20
-
-// Returns list of logged in characters with their job.
-who2: 20
-
-// Returns list of logged in characters with their party/guild.
-who3: 20
-
-// Returns list of logged in characters with their position in a specifical map.
-whomap: 20
-
-// Returns list of logged in characters with their job in a specifical map.
-whomap2: 20
-
-// Returns list of logged in characters with their party/guild in a specifical map.
-whomap3: 20
-
-// Like @who+@who2+who3, but only for GM.
-whogm: 20
-
-// Change your appearence to other players to a mob.
-disguise: 20
-
-//Restore your normal appearance.
-undisguise: 20
-
-// Display ignore list of a player (people from which the player ignore wisps)
-charignorelist: 20
-
-// Enable all wispers for a player
-inall: 20
-
-// Disable all wispers for a player
-exall: 20
-
-
-//--------------------
-// 40: Sub-GM commands
-
-// Broadcast to the whole server. Using (1 command + /nb, /b).
-broadcast: 40
-
-// Broadcast to the map you are on (1 command + /lb, /nlb).
-local_broadcast: 40
-
-// Broadcast (with or without name).
-kami: 40
-kamib: 40
-
-// Enables you to go to a certain map, at (x,y) coordinates. (@mapmove + /mm or /mapmove)
-mapmove: 40
-
-// Enables you to view other characters stats.
-charstats: 40
-
-// Shows Stats Of All Characters Online
-charstatsall: 40
-
-// Enables GVG on a map (2 same commands).
-gvgon: 40
-gpvpon: 40
-
-// Turns GVG (Guild v. Guild) off on a map (2 same commands).
-gvgoff: 40
-gpvpoff: 40
-
-// Heals a person to full HP/SP.
-heal: 40
-
-// GM Hide (enables you to be invisible to characters, and most monsters) (1 command + /hide).
-hide: 40
-
-// Changes your job to one you specify (2 same commands).
-job: 40
-jobchange: 40
-
-// Enables you to to jump randomly on a map (that you are already on).
-jump: 40
-
-// Warps you to your last save point (2 same commands).
-return: 40
-load: 40
-
-// Enables lost skills.
-lostskill: 40
-
-// Saves a warp point.
-memo: 40
-
-// Set your character display options. (Visual effects of your character)
-option: 40
-
-//Makes an egg
-makeegg: 40
-
-//Hatches an egg
-hatch: 40
-
-// Sets the level of intemecy of your pet.
-petfriendly: 40
-
-// Sets hunger level of your pet.
-pethungry: 40
-
-// Turns PVP (Person v. Person) off on a map.
-pvpoff: 40
-
-// Enables PVP on a map.
-pvpon: 40
-
-// Enables platinum skills.
-questskill: 40
-
-// Sets the speed you can walk/attack at. Default is 150.
-speed: 40
-
-// Enables spirit sphere balls.
-spiritball: 40
-
-// Warp yourself to a certain map, at (x,y) coordinates (2 same commands).
-rura: 40
-warp: 40
-
-// Changes GM clothes color (2 same commands)
-dye: 40
-ccolor: 40
-
-// Changes GM hair style (2 same commands)
-hairstyle: 40
-hstyle: 40
-
-// Changes GM hair color (2 same commands)
-haircolor: 40
-hcolor: 40
-
-// Deletes all your items.
-itemreset: 40
-
-// Kill all monsters in map (without drops)
-killmonster2: 40
-
-// Sets your spawn point (aka save point).
-save: 40
-
-// Do some visual effect on your character
-effect: 40
-
-// Display all items of a player
-charitemlist: 40
-
-// Display all items of a player's storage
-charstoragelist: 40
-
-// Display all items of a player's cart
-charcartlist: 40
-
-
-//---------------------
-// 50: Sub-GM+ commands
-
-// Changes character's model
-charmodel: 50
-
-guild: 50
-
-// Brings up your guild storage wherever you are.
-gstorage: 50
-
-// Spawns a monster, and a certain amount (3 same commands + /monster).
-spawn: 50
-monster: 50
-summon: 50
-
-// Spawns a monster with parameters not in same order of @spawn.
-monster2: 50
-
-// To get a peco to (un)ride for another player.
-charmountpeco: 50
-
-// Enables to give possibility to a player to rename his/her pet.
-charpetrename: 50
-
-
-//----------------
-// 60: GM commands
-
-// Starts Guild Wars
-agitstart: 60
-
-// Ends Guild Wars
-agitend: 60
-
-// Resurects yourself.
-alive: 60
-
-// Levels your character to specified level (adds to your level) (3 same commands).
-lvup: 60
-baselvlup: 60
-blevel: 60
-
-// Raises your job level (3 same commands).
-joblvup: 60
-joblvlup: 60
-jlevel: 60
-
-// Sets another persons base level.
-charbaselvl: 60
-
-// Changes the sex of an online player (all characters on the account)
-charchangesex: 60
-
-// Remove items from a character
-chardelitem: 60
-
-// Sets another persons job level.
-charjlvl: 60
-
-// Sets the job of another character (2 same commands).
-charjob: 60
-charjobchange: 60
-
-// Set options on another character.
-charoption: 60
-
-// Gives another character status points
-charstpoint: 60
-
-// Gives another character skill points
-charskpoint: 60
-
-// Resets another character's stats
-charreset: 60
-
-// Resets another character's status, skills
-charstreset: 60
-charskreset: 60
-
-// Saves the respawn point of another character.
-charsave: 60
-
-// Changes another character's zenny
-charzeny: 60
-
-// Levels your guild to specified level (2 same commands).
-guildlvup: 60
-guildlvlup: 60
-
-idsearch: 60
-
-// Creates an item of your choosing, either Item ID or Name (1 command + /item).
-item: 60
-
-// Creates a complet item (card, etc...) of your choosing, either Item ID or Name.
-item2: 60
-
-// ??
-itemcheck: 60
-
-// Kill another character without hitting them.
-kill: 60
-
-// Kill all monsters in map (with drops)
-killmonster: 60
-
-// Creates yourself a pet egg, have to use Pet ID.
-makeegg: 60
-
-// Instantly kills player whose name is entered and deals insane damage to everything around.
-nuke: 60
-
-// Enable hitting a player even when not in pvp
-killer: 60
-
-// Creates weapon of desired element.
-produce: 60
-
-// Warps a character to you (1 command + /recall).
-recall: 60
-
-// Refines all weapons in your items list.
-refine: 60
-
-// Will repair all broken items in inventory.
-repairall: 60
-
-// Revives a character, and heals them.
-revive: 60
-
-// Warp another person to a certain map, at (x,y) coordinates (2 same commands).
-rura+: 60
-charwarp: 60
-
-// Change Status of your character
-str: 60
-agi: 60
-vit: 60
-int: 60
-dex: 60
-luk: 60
-
-// Gets all skills (4 same commands)
-allskill: 60
-allskills: 60
-skillall: 60
-skillsall: 60
-
-// sets GM stats to maximum (4 same commands)
-statall: 60
-statsall: 60
-allstats: 60
-allstat: 60
-
-// Gives you job points.
-stpoint: 60
-
-// Gives you skill points of desired amount.
-skpoint: 60
-
-// Warps all online character of a guild to you. (at least one member of that guild must be on.)
-guildrecall: 60
-
-// Warps all online character of a party to you. (at least one party member must be online.)
-partyrecall: 60
-
-// Allows you to spy on any Guilds Guild chat. (at least one member of that guild must be on.)
-guildspy: 60
-
-//Allows you to spy on any party's party chat. (at least one party member must be online.)
-partyspy: 60
-
-// Gives you money (zeny) of desired amount.
-zeny: 60
-
-// To block definitively a player (only administrator can unblock the account) (2 same commands)
-block: 60
-charblock: 60
-
-// To unblock a player (2 same commands)
-unblock: 60
-charunblock: 60
-
-// To ban a player for a limited time (only administrator can unban the account) (4 same commands)
-ban: 60
-banish: 60
-charban: 60
-charbanish: 60
-
-// To unban a player (4 same commands)
-unban: 60
-unbanish: 60
-charunban: 60
-charunbanish: 60
-
-// To send specified character in jails
-jail: 60
-
-// To discharge a prisoner (2 same commands)
-unjail: 60
-discharge: 60
-
-// To change disguise of another player/GM
-chardisguise: 60
-charundisguise: 60
-
-// Enables platinum skills of another player.
-charquestskill: 60
-
-// Enables lost skills of another player.
-charlostskill: 60
-
-// turn on and off skills on a map
-skillon: 60
-skilloff: 60
-
-// Create a static warp portal that lasts until the next reboot
-addwarp: 60
-
-
-//----------------------
-// 80: GM Chief commands
-
-// Set the map you are on to day.
-day: 80
-
-// Kills everyone on the server.
-doom: 80
-
-// Kills everyone on the map you are on.
-doommap: 80
-
-// Set the map you are currently on to night.
-night: 80
-
-// Recalls Everyone To Your Coordinates
-recallall: 80
-
-// Revives all players on the map.
-raisemap: 80
-
-// Revives all players on the server.
-raise: 80
-
-// Enables a NPC.
-enablenpc: 80
-
-// Disables a NPC.
-disablenpc: 80
-
-// Move a NPC
-npcmove: 80
-
-
-//---------------------------
-// 99: Administrator commands
-
-// Disconnect all users from the server
-kickall: 99
-
-// Closes Map-Server
-mapexit: 99
-
-// Give information about terrain/area (debug function)
-gat: 99
-
-// Enables debugging
-packet: 99
-
-// Shows information about the map
-mapinfo: 99
-
-// Re-load item database (admin command)
-reloaditemdb: 99
-
-// Re-load monsters database (admin command)
-reloadmobdb: 99
-
-// Re-load skills database (admin command)
-reloadskilldb: 99
-
-// Re-load scripts (admin command)
-reloadscript: 99
-
-// Re-load GM level (admin command)
-reloadgmdb: 99
-
-
-//---------------------
-// OTHER: not a command
-
-//import: conf/import/atcommand_conf.txt

+ 11 - 7
src/char_sql/char.c

@@ -2755,21 +2755,25 @@ void do_final(void) {
 	do_final_itemdb();
 	//check SQL save progress.
 	//wait until save char complete
-	printf("waiting until char saving complete...\n");
-	do {
-		sleep (0);
-	}while (save_flag != 0);
 
 	set_all_offline();
 
+	flush_fifos_for_final();
+
 	sprintf(tmp_sql,"DELETE FROM `ragsrvinfo");
-	if (mysql_query(&mysql_handle, tmp_sql)) {
+	if (mysql_query(&mysql_handle, tmp_sql)) 
 		printf("DB server Error (insert `char`)- %s\n", mysql_error(&mysql_handle));
+
+	if(gm_account)  {
+		free(gm_account);
+		gm_account = 0;
 	}
 
-	if(gm_account) free(gm_account);
+	if(char_dat)  {
+		free(char_dat);
+		char_dat = 0;
+	}
 
-	if(char_dat) free(char_dat);
 	delete_session(login_fd);
 	delete_session(char_fd);
 

+ 12 - 1
src/common/socket.c

@@ -121,8 +121,10 @@ static int send_from_fifo(int fd)
 	int len;
 
 	//printf("send_from_fifo : %d\n",fd);
-	if(session[fd]->eof)
+	if(session[fd]->eof || session[fd]->wdata == 0)
 		return -1;
+	if (session[fd]->wdata_size == 0)
+		return 0;
 
 #ifdef _WIN32
 	len=send(fd, session[fd]->wdata,session[fd]->wdata_size, 0);
@@ -148,6 +150,15 @@ static int send_from_fifo(int fd)
 	return 0;
 }
 
+void flush_fifos_for_final() 
+{
+	int i;
+	for(i=0;i<fd_max;i++)
+		if(session[i] != NULL && 
+		   session[i]->func_send == send_from_fifo)
+			send_from_fifo(i);
+}
+
 static int null_parse(int fd)
 {
 	printf("null_parse : %d\n",fd);

+ 2 - 0
src/common/socket.h

@@ -90,6 +90,8 @@ int do_sendrecv(int next);
 int do_parsepacket(void);
 void do_socket(void);
 
+extern void flush_fifos_for_final();
+
 int start_console(void);
 
 void set_defaultparse(int (*defaultparse)(int));

+ 1 - 1
src/login_sql/login.c

@@ -163,7 +163,7 @@ void add_online_user(int account_id) {
 		printf("add_online_user: memory allocation failure (malloc)!\n");
 		exit(0);
 	}
-	p = &account_id;
+    *p = account_id;
     numdb_insert(online_db, account_id, p);
 }
 

+ 5 - 1
src/map/map.c

@@ -2159,6 +2159,10 @@ void do_final(void) {
 		map_foreachinarea(cleanup_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, 0, 0);
     }
 
+#ifndef TXT_ONLY
+    chrif_char_reset_offline();
+#endif
+
     for (i = 0; i < fd_max; i++) 
         delete_session(i);
 
@@ -2181,8 +2185,8 @@ void do_final(void) {
 	do_final_itemdb();
 	do_final_storage();
         do_final_guild();
+
 #ifndef TXT_ONLY
-	chrif_char_reset_offline();
     map_sql_close();
 #endif /* not TXT_ONLY */
 }