src/server/daemon/main.c

changeset 444
96d2ba2f28db
parent 443
ef3c8a0e1fee
child 556
b036ccad4b49
--- a/src/server/daemon/main.c	Sun Nov 27 13:33:30 2022 +0100
+++ b/src/server/daemon/main.c	Sun Nov 27 15:58:37 2022 +0100
@@ -77,19 +77,7 @@
  */
 void sig_usr1_reload(int sig) {
     log_ereport(LOG_INFORM, "sig reload");
-    
-    CfgManager mgr;
-    if(cfgmgr_load_config(&mgr) != 0) {
-        log_ereport(LOG_FAILURE, "cannot reload server.conf");
-    } else {
-        if(cfgmgr_apply_config(&mgr)) {
-            log_ereport(LOG_FAILURE, "cannot reload config");
-        }
-    }
-    
-    // start newly created listeners
-    start_all_listener();
-
+    (void)webserver_reconfig();
     signal(SIGUSR1, sig_usr1_reload);
 }
 
@@ -269,7 +257,6 @@
         return 1;
     }
     
-    is_daemon = 1;
     if(is_daemon) {
         // initialize startup pipes
         if(pipe(daemon_start_pipe)) {
@@ -324,9 +311,9 @@
         }
         
         dup2(std_out[1], 1);
-        //dup2(std_err[1], 2);
+        dup2(std_err[1], 2);
         close(std_out[1]);
-        //close(std_err[1]);
+        close(std_err[1]);
         
         // set log thread stack size
         pthread_attr_t tattr;
@@ -371,20 +358,6 @@
     if(srvctrl_wait()) {
         return EXIT_FAILURE;
     }
-    
-    /* TODO: join threads (or not?) */
-/*
-    while(1) {
-        if(is_daemon) {
-            fflush(stdout);
-            fflush(stderr);
-        }
-        sleep(10000);
-        if(0) {
-            break;
-        }
-    }
-*/
 
     return EXIT_SUCCESS;
 }

mercurial