diff options
author | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-29 05:19:01 +0000 |
---|---|---|
committer | amber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-11-29 05:19:01 +0000 |
commit | 02720aae3af5cc563a8b6dd374b5aebd5a0da074 (patch) | |
tree | 59ebbe47fe076464218bbde1a5206768ae1d0601 /src | |
parent | 893a5922031f91f0599480d2ffbf525b76803165 (diff) | |
download | hercules-02720aae3af5cc563a8b6dd374b5aebd5a0da074.tar.gz hercules-02720aae3af5cc563a8b6dd374b5aebd5a0da074.tar.bz2 hercules-02720aae3af5cc563a8b6dd374b5aebd5a0da074.tar.xz hercules-02720aae3af5cc563a8b6dd374b5aebd5a0da074.zip |
A few bug fixes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@412 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/char_sql/char.c | 18 | ||||
-rw-r--r-- | src/common/socket.c | 13 | ||||
-rw-r--r-- | src/common/socket.h | 2 | ||||
-rw-r--r-- | src/login_sql/login.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 6 |
5 files changed, 31 insertions, 10 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 25141e08f..9505b2819 100644 --- a/src/char_sql/char.c +++ b/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); diff --git a/src/common/socket.c b/src/common/socket.c index 4afcf50d4..703361627 100644 --- a/src/common/socket.c +++ b/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); diff --git a/src/common/socket.h b/src/common/socket.h index e3ad0826a..94ca1b93f 100644 --- a/src/common/socket.h +++ b/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)); diff --git a/src/login_sql/login.c b/src/login_sql/login.c index ba03848e8..1863913fc 100644 --- a/src/login_sql/login.c +++ b/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); } diff --git a/src/map/map.c b/src/map/map.c index 4addd1a26..0674cd65b 100644 --- a/src/map/map.c +++ b/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 */ } |