/[LeafOK_CVS]/lbbs/src/user_list.c
ViewVC logotype

Diff of /lbbs/src/user_list.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.28 by sysadm, Tue Nov 4 14:58:56 2025 UTC Revision 1.32 by sysadm, Tue Nov 11 00:28:05 2025 UTC
# Line 6  Line 6 
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>
7   */   */
8    
9    #ifdef HAVE_CONFIG_H
10    #include "config.h"
11    #endif
12    
13  #include "common.h"  #include "common.h"
14  #include "database.h"  #include "database.h"
15  #include "log.h"  #include "log.h"
# Line 33  union semun Line 37  union semun
37  };  };
38  #endif // #ifdef _SEM_SEMUN_UNDEFINED  #endif // #ifdef _SEM_SEMUN_UNDEFINED
39    
40  #define USER_LIST_TRY_LOCK_WAIT_TIME 1 // second  enum _user_list_constant_t
41  #define USER_LIST_TRY_LOCK_TIMES 10  {
42            USER_LIST_TRY_LOCK_WAIT_TIME = 1, // second
43            USER_LIST_TRY_LOCK_TIMES = 10,
44    };
45    
46  struct user_list_pool_t  struct user_list_pool_t
47  {  {
# Line 181  int user_list_load(MYSQL *db, USER_LIST Line 188  int user_list_load(MYSQL *db, USER_LIST
188                  p_list->users[i].signup_dt = (row[8] == NULL ? 0 : atol(row[8]));                  p_list->users[i].signup_dt = (row[8] == NULL ? 0 : atol(row[8]));
189                  p_list->users[i].last_login_dt = (row[9] == NULL ? 0 : atol(row[9]));                  p_list->users[i].last_login_dt = (row[9] == NULL ? 0 : atol(row[9]));
190                  p_list->users[i].last_logout_dt = (row[10] == NULL ? 0 : atol(row[10]));                  p_list->users[i].last_logout_dt = (row[10] == NULL ? 0 : atol(row[10]));
191                  p_list->users[i].birthday = (row[10] == NULL ? 0 : atol(row[11]));                  p_list->users[i].birthday = (row[11] == NULL ? 0 : atol(row[11]));
192                  intro_len = strlen((row[12] == NULL ? "" : row[12]));                  intro_len = strlen((row[12] == NULL ? "" : row[12]));
193                  if (intro_len >= sizeof(p_list->user_intro_buf) - 1 - intro_buf_offset)                  if (intro_len >= sizeof(p_list->user_intro_buf) - 1 - intro_buf_offset)
194                  {                  {
# Line 335  int user_online_list_load(MYSQL *db, USE Line 342  int user_online_list_load(MYSQL *db, USE
342                  }                  }
343    
344                  qsort(p_online_list->index_uid, (size_t)user_cnt, sizeof(USER_INFO_INDEX_UID), user_info_index_uid_comp);                  qsort(p_online_list->index_uid, (size_t)user_cnt, sizeof(USER_INFO_INDEX_UID), user_info_index_uid_comp);
   
 #ifdef _DEBUG  
                 log_error("Rebuild index of %d online users\n", user_cnt);  
 #endif  
345          }          }
346    
347          p_online_list->user_count = user_cnt;          p_online_list->user_count = user_cnt;
348          p_online_list->guest_count = guest_cnt;          p_online_list->guest_count = guest_cnt;
349    
 #ifdef _DEBUG  
         log_error("Loaded %d online users and %d guest users\n", p_list->user_count, p_list->guest_count);  
 #endif  
   
350  cleanup:  cleanup:
351          mysql_free_result(rs);          mysql_free_result(rs);
352    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1