/[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.67 by sysadm, Wed Jun 25 02:49:20 2025 UTC Revision 1.69 by sysadm, Sun Jun 29 02:28:02 2025 UTC
# Line 407  int net_server(const char *hostaddr, in_ Line 407  int net_server(const char *hostaddr, in_
407                          }                          }
408    
409                          sd_notifyf(0, "STATUS=Waiting for %d child process to exit", SYS_child_process_count);                          sd_notifyf(0, "STATUS=Waiting for %d child process to exit", SYS_child_process_count);
410    
411                            sleep(1); // Sleep for a while to avoid notifying child processes too frequently
412                  }                  }
413    
414                  if (SYS_conf_reload && !SYS_server_exit)                  if (SYS_conf_reload && !SYS_server_exit)
# Line 420  int net_server(const char *hostaddr, in_ Line 422  int net_server(const char *hostaddr, in_
422                                  log_error("Reload conf failed\n");                                  log_error("Reload conf failed\n");
423                          }                          }
424    
425                          // acquire rw lock of all sections to avoid conflict with menu reload in data loader process                          if (load_menu(&bbs_menu_new, CONF_MENU) < 0)
                         ret = section_list_rw_lock(NULL);  
                         if (ret < 0)  
426                          {                          {
427                                  log_error("section_list_rw_lock(NULL) error\n");                                  unload_menu(&bbs_menu_new);
428                                    log_error("Reload menu failed\n");
429                          }                          }
430                          else                          else
431                          {                          {
432                                  if (load_menu(&bbs_menu_new, CONF_MENU) < 0)                                  unload_menu(&bbs_menu);
433                                  {                                  memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));
434                                          unload_menu(&bbs_menu_new);                                  log_common("Reload menu successfully\n");
                                         log_error("Reload menu failed\n");  
                                 }  
                                 else  
                                 {  
                                         unload_menu(&bbs_menu);  
                                         memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));  
                                         log_common("Reload menu successfully\n");  
                                 }  
   
                                 // release rw lock of all sections  
                                 ret = section_list_rw_unlock(NULL);  
                                 if (ret < 0)  
                                 {  
                                         log_error("section_list_rw_unlock(NULL) error\n");  
                                 }  
435                          }                          }
436    
                         sd_notify(0, "READY=1");  
                 }  
   
                 if (SYS_data_file_reload && !SYS_server_exit)  
                 {  
                         SYS_data_file_reload = 0;  
                         sd_notify(0, "RELOADING=1");  
   
437                          for (int i = 0; i < data_files_load_startup_count; i++)                          for (int i = 0; i < data_files_load_startup_count; i++)
438                          {                          {
439                                  if (load_file(data_files_load_startup[i]) < 0)                                  if (load_file(data_files_load_startup[i]) < 0)
# Line 463  int net_server(const char *hostaddr, in_ Line 441  int net_server(const char *hostaddr, in_
441                                          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]);
442                                  }                                  }
443                          }                          }
   
444                          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;  
445    
446                          if (section_list_loader_reload() < 0)                          // Load section config and gen_ex
447                            if (load_section_config_from_db(1) < 0)
448                            {
449                                    log_error("load_section_config_from_db(1) error\n");
450                            }
451                            else
452                          {                          {
453                                  log_error("section_list_loader_reload() failed\n");                                  log_common("Reload section config and gen_ex successfully\n");
454                          }                          }
455    
456                            sd_notify(0, "READY=1");
457                  }                  }
458    
459                  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