| 22 |
#include "log.h" |
#include "log.h" |
| 23 |
#include "menu.h" |
#include "menu.h" |
| 24 |
#include "section_list_loader.h" |
#include "section_list_loader.h" |
| 25 |
|
#include "user_list.h" |
| 26 |
#include "user_priv.h" |
#include "user_priv.h" |
| 27 |
#include <errno.h> |
#include <errno.h> |
| 28 |
#include <signal.h> |
#include <signal.h> |
| 690 |
int article_count; |
int article_count; |
| 691 |
int load_count; |
int load_count; |
| 692 |
int last_mid; |
int last_mid; |
| 693 |
int i; |
time_t tm_section_list_reload = 0; |
| 694 |
|
time_t tm_user_list_reload = 0; |
| 695 |
|
|
| 696 |
if (section_list_loader_pid != 0) |
if (section_list_loader_pid != 0) |
| 697 |
{ |
{ |
| 736 |
// Do section data loader periodically |
// Do section data loader periodically |
| 737 |
while (!SYS_server_exit) |
while (!SYS_server_exit) |
| 738 |
{ |
{ |
| 739 |
|
tm_section_list_reload = time(NULL); |
| 740 |
|
|
| 741 |
if (SYS_conf_reload) |
if (SYS_conf_reload) |
| 742 |
{ |
{ |
| 743 |
SYS_conf_reload = 0; |
SYS_conf_reload = 0; |
| 803 |
log_common("Proceeded %d article logs, last_mid = %d\n", last_article_op_log_mid - last_mid, last_article_op_log_mid); |
log_common("Proceeded %d article logs, last_mid = %d\n", last_article_op_log_mid - last_mid, last_article_op_log_mid); |
| 804 |
} |
} |
| 805 |
|
|
| 806 |
if (SYS_conf_reload) |
// Reload user list |
| 807 |
|
if (time(NULL) - tm_user_list_reload >= BBS_user_list_load_interval) |
| 808 |
{ |
{ |
| 809 |
continue; |
if (user_list_pool_reload() < 0) |
| 810 |
|
{ |
| 811 |
|
log_error("user_list_pool_reload() error\n"); |
| 812 |
|
} |
| 813 |
|
tm_user_list_reload = time(NULL); |
| 814 |
} |
} |
| 815 |
|
|
| 816 |
for (i = 0; i < BBS_section_list_load_interval && !SYS_server_exit && !SYS_conf_reload; i++) |
// Wait for BBS_section_list_load_interval seconds |
| 817 |
|
while (!SYS_server_exit && time(NULL) - tm_section_list_reload < BBS_section_list_load_interval) |
| 818 |
{ |
{ |
| 819 |
sleep(1); |
sleep(1); |
| 820 |
} |
} |
| 831 |
detach_section_list_shm(); |
detach_section_list_shm(); |
| 832 |
detach_article_block_shm(); |
detach_article_block_shm(); |
| 833 |
detach_trie_dict_shm(); |
detach_trie_dict_shm(); |
| 834 |
|
detach_user_list_pool_shm(); |
| 835 |
|
|
| 836 |
log_common("Section list loader process exit normally\n"); |
log_common("Section list loader process exit normally\n"); |
| 837 |
log_end(); |
log_end(); |