Bläddra i källkod

core: use current config for the attendant process

Changes in relevant config variables at runtime are now visible in
the attendant process (e.g. debug, memlog, mem_summary).

Signed-off-by: Miklos Tirpak <[email protected]>
Andrei Pelinescu-Onciul 16 år sedan
förälder
incheckning
7362f8245b
1 ändrade filer med 8 tillägg och 0 borttagningar
  1. 8 0
      main.c

+ 8 - 0
main.c

@@ -510,6 +510,10 @@ void cleanup(show_status)
 	/* restore the original core configuration before the
 	/* restore the original core configuration before the
 	 * config block is freed, otherwise even logging is unusable,
 	 * config block is freed, otherwise even logging is unusable,
 	 * it can case segfault */
 	 * it can case segfault */
+	cfg_update();
+	/* copy current config into default_core_cfg */
+	if (core_cfg)
+		default_core_cfg=*((struct cfg_group_core*)core_cfg);
 	core_cfg = &default_core_cfg;
 	core_cfg = &default_core_cfg;
 	cfg_destroy();
 	cfg_destroy();
 #ifdef USE_TCP
 #ifdef USE_TCP
@@ -775,6 +779,7 @@ void sig_usr(int signo)
 					LOG(L_INFO, "INFO: signal %d received\n", signo);
 					LOG(L_INFO, "INFO: signal %d received\n", signo);
 					/* print memory stats for non-main too */
 					/* print memory stats for non-main too */
 					#ifdef PKG_MALLOC
 					#ifdef PKG_MALLOC
+					cfg_update(); /* make sure we have current values */
 					memlog=cfg_get(core, core_cfg, memlog);
 					memlog=cfg_get(core, core_cfg, memlog);
 					if (memlog <= cfg_get(core, core_cfg, debug)){
 					if (memlog <= cfg_get(core, core_cfg, debug)){
 						if (cfg_get(core, core_cfg, mem_summary) & 1) {
 						if (cfg_get(core, core_cfg, mem_summary) & 1) {
@@ -1529,6 +1534,8 @@ int main_loop()
 			unix_tcp_sock=-1;
 			unix_tcp_sock=-1;
 		}
 		}
 #endif
 #endif
+		/* init cfg, but without per child callbacks support */
+		cfg_child_no_cb_init();
 
 
 #ifdef EXTRA_DEBUG
 #ifdef EXTRA_DEBUG
 		for (r=0; r<*process_count; r++){
 		for (r=0; r<*process_count; r++){
@@ -1540,6 +1547,7 @@ int main_loop()
 		for(;;){
 		for(;;){
 			handle_sigs();
 			handle_sigs();
 			pause();
 			pause();
+			cfg_update();
 		}
 		}
 	
 	
 	}
 	}