[sr-dev] git:master: core: use current config for the attendant process

Miklos Tirpak miklos at iptel.org
Wed Sep 30 09:26:46 CEST 2009


Module: sip-router
Branch: master
Commit: 7362f8245bf66205c4720f65cf07c0db8039f191
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7362f8245bf66205c4720f65cf07c0db8039f191

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Miklos Tirpak <miklos at iptel.org>
Date:   Tue Sep 29 17:22:01 2009 +0200

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 at iptel.org>

---

 main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/main.c b/main.c
index 04d34b0..47d8ccc 100644
--- a/main.c
+++ b/main.c
@@ -510,6 +510,10 @@ void cleanup(show_status)
 	/* restore the original core configuration before the
 	 * config block is freed, otherwise even logging is unusable,
 	 * 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;
 	cfg_destroy();
 #ifdef USE_TCP
@@ -775,6 +779,7 @@ void sig_usr(int signo)
 					LOG(L_INFO, "INFO: signal %d received\n", signo);
 					/* print memory stats for non-main too */
 					#ifdef PKG_MALLOC
+					cfg_update(); /* make sure we have current values */
 					memlog=cfg_get(core, core_cfg, memlog);
 					if (memlog <= cfg_get(core, core_cfg, debug)){
 						if (cfg_get(core, core_cfg, mem_summary) & 1) {
@@ -1529,6 +1534,8 @@ int main_loop()
 			unix_tcp_sock=-1;
 		}
 #endif
+		/* init cfg, but without per child callbacks support */
+		cfg_child_no_cb_init();
 
 #ifdef EXTRA_DEBUG
 		for (r=0; r<*process_count; r++){
@@ -1540,6 +1547,7 @@ int main_loop()
 		for(;;){
 			handle_sigs();
 			pause();
+			cfg_update();
 		}
 	
 	}




More information about the sr-dev mailing list