summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-05-31 02:28:06 +0200
committerHaru <haru@dotalux.com>2017-05-31 02:34:10 +0200
commit4b208e41d1d5cc995c2816e8f34c1ad8b0a7327d (patch)
tree5359f1cef645f89bfdd7d783b8e4d1176e192c5d /src/char/char.c
parentb950a589e59e2bf074f67c75aaacf3f82424d4fe (diff)
downloadhercules-4b208e41d1d5cc995c2816e8f34c1ad8b0a7327d.tar.gz
hercules-4b208e41d1d5cc995c2816e8f34c1ad8b0a7327d.tar.bz2
hercules-4b208e41d1d5cc995c2816e8f34c1ad8b0a7327d.tar.xz
hercules-4b208e41d1d5cc995c2816e8f34c1ad8b0a7327d.zip
Fix a race condition when saving the storage on logout
The storage data is no longer cached in the char server. This removal doesn't cause any performance loss, since the cached data was refreshed (loaded from the database) after every save operation. This commit moves the load at the beginning of the save rather than at the end, and discars the cached copy after the save is completed. Related to #1754 Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 5a5a0d7f2..f6556073e 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -288,16 +288,12 @@ void char_set_char_offline(int char_id, int account_id)
else
{
struct mmo_charstatus* cp = (struct mmo_charstatus*) idb_get(chr->char_db_,char_id);
- struct storage_data *stor = (struct storage_data *) idb_get(inter_storage->account_storage, account_id);
inter_guild->CharOffline(char_id, cp?cp->guild_id:-1);
if (cp)
idb_remove(chr->char_db_,char_id);
- if (stor) /* Remove inter-storage data. */
- inter_storage->delete_account_storage(account_id);
-
if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `online`='0' WHERE `char_id`='%d' LIMIT 1", char_db, char_id) )
Sql_ShowDebug(inter->sql_handle);
}