/[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.92 by sysadm, Tue Nov 18 12:12:52 2025 UTC Revision 1.96 by sysadm, Fri Nov 21 10:34:10 2025 UTC
# Line 446  static int fork_server(void) Line 446  static int fork_server(void)
446    
447          SYS_child_process_count = 0;          SYS_child_process_count = 0;
448    
449            // BWF compile
450            if (bwf_compile() < 0)
451            {
452                    log_error("bwf_compile() error\n");
453                    goto cleanup;
454            }
455    
456          bbs_main();          bbs_main();
457    
458  cleanup:  cleanup:
# Line 482  cleanup: Line 489  cleanup:
489          ssh_free(SSH_session);          ssh_free(SSH_session);
490          ssh_finalize();          ssh_finalize();
491    
492            // BWF cleanup
493            bwf_cleanup();
494    
495          // Close Input and Output for client          // Close Input and Output for client
496          io_cleanup();          io_cleanup();
497          close(STDIN_FILENO);          close(STDIN_FILENO);
# Line 511  int net_server(const char *hostaddr, in_ Line 521  int net_server(const char *hostaddr, in_
521          int nfds;          int nfds;
522          int notify_child_exit = 0;          int notify_child_exit = 0;
523          time_t tm_notify_child_exit = time(NULL);          time_t tm_notify_child_exit = time(NULL);
         MENU_SET bbs_menu_new;  
         MENU_SET top10_menu_new;  
524          int i, j;          int i, j;
525          pid_t pid;          pid_t pid;
526          int ssh_log_level = SSH_LOG_NOLOG;          int ssh_log_level = SSH_LOG_NOLOG;
# Line 704  int net_server(const char *hostaddr, in_ Line 712  int net_server(const char *hostaddr, in_
712                                  log_common("Notify %d child process to exit\n", SYS_child_process_count);                                  log_common("Notify %d child process to exit\n", SYS_child_process_count);
713  #endif  #endif
714    
715                                  if (kill(-getpid(), SIGTERM) < 0)                                  if (kill(0, SIGTERM) < 0)
716                                  {                                  {
717                                          log_error("Send SIGTERM signal failed (%d)\n", errno);                                          log_error("Send SIGTERM signal failed (%d)\n", errno);
718                                  }                                  }
# Line 718  int net_server(const char *hostaddr, in_ Line 726  int net_server(const char *hostaddr, in_
726                                  sd_notifyf(0, "STATUS=Kill %d child process", SYS_child_process_count);                                  sd_notifyf(0, "STATUS=Kill %d child process", SYS_child_process_count);
727  #endif  #endif
728    
729                                  if (kill(-getpid(), SIGKILL) < 0)                                  if (kill(0, SIGKILL) < 0)
730                                  {                                  {
731                                          log_error("Send SIGKILL signal failed (%d)\n", errno);                                          log_error("Send SIGKILL signal failed (%d)\n", errno);
732                                  }                                  }
# Line 759  int net_server(const char *hostaddr, in_ Line 767  int net_server(const char *hostaddr, in_
767                                  log_error("Reload BWF conf failed\n");                                  log_error("Reload BWF conf failed\n");
768                          }                          }
769    
770                          if (load_menu(&bbs_menu_new, CONF_MENU) < 0)                          if (detach_menu_shm(&bbs_menu) < 0)
771                          {                          {
772                                  unload_menu(&bbs_menu_new);                                  log_error("detach_menu_shm(bbs_menu) error\n");
                                 log_error("Reload bbs menu failed\n");  
773                          }                          }
774                          else                          if (load_menu(&bbs_menu, CONF_MENU) < 0)
775                          {                          {
776                                    log_error("load_menu(bbs_menu) error\n");
777                                  unload_menu(&bbs_menu);                                  unload_menu(&bbs_menu);
                                 memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));  
                                 log_common("Reload bbs menu successfully\n");  
778                          }                          }
779    
780                          if (load_menu(&top10_menu_new, CONF_TOP10_MENU) < 0)                          if (detach_menu_shm(&top10_menu) < 0)
781                          {                          {
782                                  unload_menu(&top10_menu_new);                                  log_error("detach_menu_shm(top10_menu) error\n");
                                 log_error("Reload top10 menu failed\n");  
783                          }                          }
784                          else                          if (load_menu(&top10_menu, CONF_TOP10_MENU) < 0)
785                          {                          {
786                                    log_error("load_menu(top10_menu) error\n");
787                                  unload_menu(&top10_menu);                                  unload_menu(&top10_menu);
                                 top10_menu_new.allow_exit = 1;  
                                 memcpy(&top10_menu, &top10_menu_new, sizeof(top10_menu_new));  
                                 log_common("Reload top10 menu successfully\n");  
788                          }                          }
789    
790                          for (int i = 0; i < data_files_load_startup_count; i++)                          for (int i = 0; i < data_files_load_startup_count; i++)
# Line 791  int net_server(const char *hostaddr, in_ Line 794  int net_server(const char *hostaddr, in_
794                                          log_error("load_file(%s) error\n", data_files_load_startup[i]);                                          log_error("load_file(%s) error\n", data_files_load_startup[i]);
795                                  }                                  }
796                          }                          }
                         log_common("Reload data files successfully\n");  
797    
798                          // Load section config and gen_ex                          // Load section config and gen_ex
799                          if (load_section_config_from_db(1) < 0)                          if (load_section_config_from_db(1) < 0)
800                          {                          {
801                                  log_error("load_section_config_from_db(1) error\n");                                  log_error("load_section_config_from_db(1) error\n");
802                          }                          }
                         else  
                         {  
                                 log_common("Reload section config and gen_ex successfully\n");  
                         }  
803    
804                          // Notify child processes to reload configuration                          // Notify child processes to reload configuration
805                          if (kill(-getpid(), SIGUSR1) < 0)                          if (kill(0, SIGUSR1) < 0)
806                          {                          {
807                                  log_error("Send SIGUSR1 signal failed (%d)\n", errno);                                  log_error("Send SIGUSR1 signal failed (%d)\n", errno);
808                          }                          }


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

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