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

Diff of /lbbs/src/net_server.c

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

Revision 1.65 by sysadm, Tue Jun 24 10:01:24 2025 UTC Revision 1.68 by sysadm, Thu Jun 26 12:17:02 2025 UTC
# Line 25  Line 25 
25  #include "login.h"  #include "login.h"
26  #include "menu.h"  #include "menu.h"
27  #include "net_server.h"  #include "net_server.h"
28    #include "section_list.h"
29  #include "section_list_loader.h"  #include "section_list_loader.h"
30  #include <errno.h>  #include <errno.h>
31  #include <fcntl.h>  #include <fcntl.h>
# Line 258  int net_server(const char *hostaddr, in_ Line 259  int net_server(const char *hostaddr, in_
259          int nfds, epollfd;          int nfds, epollfd;
260          siginfo_t siginfo;          siginfo_t siginfo;
261          int sd_notify_stopping = 0;          int sd_notify_stopping = 0;
262          MENU_SET *p_bbs_menu_new;          MENU_SET bbs_menu_new;
263          int i, j;          int i, j;
264          pid_t pid;          pid_t pid;
265          int ssh_log_level = SSH_LOG_NOLOG;          int ssh_log_level = SSH_LOG_NOLOG;
# Line 419  int net_server(const char *hostaddr, in_ Line 420  int net_server(const char *hostaddr, in_
420                                  log_error("Reload conf failed\n");                                  log_error("Reload conf failed\n");
421                          }                          }
422    
423                          p_bbs_menu_new = calloc(1, sizeof(MENU_SET));                          if (load_menu(&bbs_menu_new, CONF_MENU) < 0)
                         if (p_bbs_menu_new == NULL)  
424                          {                          {
425                                  log_error("OOM: calloc(MENU_SET)\n");                                  unload_menu(&bbs_menu_new);
                         }  
                         else if (load_menu(p_bbs_menu_new, CONF_MENU) < 0)  
                         {  
                                 unload_menu(p_bbs_menu_new);  
                                 free(p_bbs_menu_new);  
                                 p_bbs_menu_new = NULL;  
   
426                                  log_error("Reload menu failed\n");                                  log_error("Reload menu failed\n");
427                          }                          }
428                          else                          else
429                          {                          {
430                                  unload_menu(p_bbs_menu);                                  unload_menu(&bbs_menu);
431                                  free(p_bbs_menu);                                  memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));
   
                                 p_bbs_menu = p_bbs_menu_new;  
                                 p_bbs_menu_new = NULL;  
   
432                                  log_common("Reload menu successfully\n");                                  log_common("Reload menu successfully\n");
433                          }                          }
434    
                         sd_notify(0, "READY=1");  
                 }  
   
                 if (SYS_data_file_reload && !SYS_server_exit)  
                 {  
                         SYS_data_file_reload = 0;  
                         sd_notify(0, "RELOADING=1");  
   
435                          for (int i = 0; i < data_files_load_startup_count; i++)                          for (int i = 0; i < data_files_load_startup_count; i++)
436                          {                          {
437                                  if (load_file(data_files_load_startup[i]) < 0)                                  if (load_file(data_files_load_startup[i]) < 0)
# Line 458  int net_server(const char *hostaddr, in_ Line 439  int net_server(const char *hostaddr, in_
439                                          log_error("load_file_mmap(%s) error\n", data_files_load_startup[i]);                                          log_error("load_file_mmap(%s) error\n", data_files_load_startup[i]);
440                                  }                                  }
441                          }                          }
   
442                          log_common("Reload data files successfully\n");                          log_common("Reload data files successfully\n");
                         sd_notify(0, "READY=1");  
                 }  
   
                 if (SYS_section_list_reload && !SYS_server_exit)  
                 {  
                         SYS_section_list_reload = 0;  
443    
444                          if (section_list_loader_reload() < 0)                          // Load section config and gen_ex
445                            if (load_section_config_from_db(1) < 0)
446                          {                          {
447                                  log_error("section_list_loader_reload() failed\n");                                  log_error("load_section_config_from_db(1) error\n");
448                          }                          }
449                            else
450                            {
451                                    log_common("Reload section config and gen_ex successfully\n");
452                            }
453    
454                            sd_notify(0, "READY=1");
455                  }                  }
456    
457                  nfds = epoll_wait(epollfd, events, MAX_EVENTS, 100); // 0.1 second                  nfds = epoll_wait(epollfd, events, MAX_EVENTS, 100); // 0.1 second


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

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