/[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.67 by sysadm, Wed Jun 25 02:49:20 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));                          // acquire rw lock of all sections to avoid conflict with menu reload in data loader process
424                          if (p_bbs_menu_new == NULL)                          ret = section_list_rw_lock(NULL);
425                            if (ret < 0)
426                          {                          {
427                                  log_error("OOM: calloc(MENU_SET)\n");                                  log_error("section_list_rw_lock(NULL) error\n");
                         }  
                         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;  
   
                                 log_error("Reload menu failed\n");  
428                          }                          }
429                          else                          else
430                          {                          {
431                                  unload_menu(p_bbs_menu);                                  if (load_menu(&bbs_menu_new, CONF_MENU) < 0)
432                                  free(p_bbs_menu);                                  {
433                                            unload_menu(&bbs_menu_new);
434                                  p_bbs_menu = p_bbs_menu_new;                                          log_error("Reload menu failed\n");
435                                  p_bbs_menu_new = NULL;                                  }
436                                    else
437                                    {
438                                            unload_menu(&bbs_menu);
439                                            memcpy(&bbs_menu, &bbs_menu_new, sizeof(bbs_menu_new));
440                                            log_common("Reload menu successfully\n");
441                                    }
442    
443                                  log_common("Reload menu successfully\n");                                  // release rw lock of all sections
444                                    ret = section_list_rw_unlock(NULL);
445                                    if (ret < 0)
446                                    {
447                                            log_error("section_list_rw_unlock(NULL) error\n");
448                                    }
449                          }                          }
450    
451                          sd_notify(0, "READY=1");                          sd_notify(0, "READY=1");


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

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