Browse code

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 <miklos@iptel.org>

Andrei Pelinescu-Onciul authored on 29/09/2009 15:22:01
Showing 1 changed files
... ...
@@ -510,6 +510,10 @@ void cleanup(show_status)
510 510
 	/* restore the original core configuration before the
511 511
 	 * config block is freed, otherwise even logging is unusable,
512 512
 	 * it can case segfault */
513
+	cfg_update();
514
+	/* copy current config into default_core_cfg */
515
+	if (core_cfg)
516
+		default_core_cfg=*((struct cfg_group_core*)core_cfg);
513 517
 	core_cfg = &default_core_cfg;
514 518
 	cfg_destroy();
515 519
 #ifdef USE_TCP
... ...
@@ -775,6 +779,7 @@ void sig_usr(int signo)
775 775
 					LOG(L_INFO, "INFO: signal %d received\n", signo);
776 776
 					/* print memory stats for non-main too */
777 777
 					#ifdef PKG_MALLOC
778
+					cfg_update(); /* make sure we have current values */
778 779
 					memlog=cfg_get(core, core_cfg, memlog);
779 780
 					if (memlog <= cfg_get(core, core_cfg, debug)){
780 781
 						if (cfg_get(core, core_cfg, mem_summary) & 1) {
... ...
@@ -1529,6 +1534,8 @@ int main_loop()
1529 1529
 			unix_tcp_sock=-1;
1530 1530
 		}
1531 1531
 #endif
1532
+		/* init cfg, but without per child callbacks support */
1533
+		cfg_child_no_cb_init();
1532 1534
 
1533 1535
 #ifdef EXTRA_DEBUG
1534 1536
 		for (r=0; r<*process_count; r++){
... ...
@@ -1540,6 +1547,7 @@ int main_loop()
1540 1540
 		for(;;){
1541 1541
 			handle_sigs();
1542 1542
 			pause();
1543
+			cfg_update();
1543 1544
 		}
1544 1545
 	
1545 1546
 	}