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 • Miklos Tirpak committed on 30/09/2009 07:26:13
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 779
 					LOG(L_INFO, "INFO: signal %d received\n", signo);
776 780
 					/* print memory stats for non-main too */
777 781
 					#ifdef PKG_MALLOC
782
+					cfg_update(); /* make sure we have current values */
778 783
 					memlog=cfg_get(core, core_cfg, memlog);
779 784
 					if (memlog <= cfg_get(core, core_cfg, debug)){
780 785
 						if (cfg_get(core, core_cfg, mem_summary) & 1) {
... ...
@@ -1529,6 +1534,8 @@ int main_loop()
1529 1534
 			unix_tcp_sock=-1;
1530 1535
 		}
1531 1536
 #endif
1537
+		/* init cfg, but without per child callbacks support */
1538
+		cfg_child_no_cb_init();
1532 1539
 
1533 1540
 #ifdef EXTRA_DEBUG
1534 1541
 		for (r=0; r<*process_count; r++){
... ...
@@ -1540,6 +1547,7 @@ int main_loop()
1540 1547
 		for(;;){
1541 1548
 			handle_sigs();
1542 1549
 			pause();
1550
+			cfg_update();
1543 1551
 		}
1544 1552
 	
1545 1553
 	}