[sr-dev] git:tirpi/cfg_framework_multivalue: cfg framework: timer must reset the handles more frequently

Miklos Tirpak miklos at iptel.org
Mon Oct 4 16:29:42 CEST 2010


Module: sip-router
Branch: tirpi/cfg_framework_multivalue
Commit: 58829230eec1efba3cd1b217d6d55127fec152d6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=58829230eec1efba3cd1b217d6d55127fec152d6

Author: Miklos Tirpak <miklos at iptel.org>
Committer: Miklos Tirpak <miklos at iptel.org>
Date:   Mon Oct  4 16:27:24 2010 +0200

cfg framework: timer must reset the handles more frequently

The timer processes must reset the cfg group handles after
each registered timer function is executed, otherwise cfg_select()
in one function may influence another function.

---

 cfg/cfg_struct.h |   10 ++++++++++
 timer.c          |    4 ++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/cfg/cfg_struct.h b/cfg/cfg_struct.h
index 0c62a3d..adde858 100644
--- a/cfg/cfg_struct.h
+++ b/cfg/cfg_struct.h
@@ -421,6 +421,16 @@ static inline void cfg_reset_handles(void)
 			cfg_update_local(1); \
 	} while(0)
 
+/* Reset all the group handles in the child process,
+ * i.e. move them back to the default local configuration.
+ */
+#define cfg_reset_all() \
+	do { \
+		if (unlikely(cfg_ginst_count)) \
+			cfg_reset_handles(); \
+	} while(0)
+
+
 /* searches a group by name */
 cfg_group_t *cfg_lookup_group(char *name, int len);
 	
diff --git a/timer.c b/timer.c
index ddce7e2..efba92d 100644
--- a/timer.c
+++ b/timer.c
@@ -892,6 +892,8 @@ inline static void timer_list_expire(ticks_t t, struct timer_head* h
 #endif
 			UNLOCK_TIMER_LIST(); /* acts also as write barrier */ 
 				ret=tl->f(t, tl, tl->data);
+				/* reset the configuration group handles */
+				cfg_reset_all();
 				if (ret==0){
 					UNSET_RUNNING();
 					LOCK_TIMER_LIST();
@@ -1147,6 +1149,8 @@ void slow_timer_main()
 				SET_RUNNING_SLOW(tl);
 				UNLOCK_SLOW_TIMER_LIST();
 					ret=tl->f(*ticks, tl, tl->data);
+					/* reset the configuration group handles */
+					cfg_reset_all();
 					if (ret==0){
 						/* one shot */
 						UNSET_RUNNING_SLOW();




More information about the sr-dev mailing list