[sr-dev] git:master:77b1b52f: uac: new modparam reg_gc_interval

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 2 18:37:35 CEST 2019


Module: kamailio
Branch: master
Commit: 77b1b52fee7939ec1fcd04952d34649569c7233d
URL: https://github.com/kamailio/kamailio/commit/77b1b52fee7939ec1fcd04952d34649569c7233d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-07-02T18:30:48+02:00

uac: new modparam reg_gc_interval

- defined value for garbage collection interval made configurable
- default value 150 (secs) - what was so far

---

Modified: src/modules/uac/uac.c
Modified: src/modules/uac/uac_reg.c

---

Diff:  https://github.com/kamailio/kamailio/commit/77b1b52fee7939ec1fcd04952d34649569c7233d.diff
Patch: https://github.com/kamailio/kamailio/commit/77b1b52fee7939ec1fcd04952d34649569c7233d.patch

---

diff --git a/src/modules/uac/uac.c b/src/modules/uac/uac.c
index 53a1b13cdf..217d1628ab 100644
--- a/src/modules/uac/uac.c
+++ b/src/modules/uac/uac.c
@@ -107,6 +107,7 @@ static void mod_destroy(void);
 static int child_init(int rank);
 
 extern int reg_timer_interval;
+extern int _uac_reg_gc_interval;
 
 static pv_export_t mod_pvs[] = {
 	{ {"uac_req", sizeof("uac_req")-1}, PVT_OTHER, pv_get_uac_req, pv_set_uac_req,
@@ -170,6 +171,7 @@ static param_export_t params[] = {
 	{"reg_keep_callid",	INT_PARAM,			&reg_keep_callid       },
 	{"reg_random_delay",	INT_PARAM,			&reg_random_delay      },
 	{"reg_active",	INT_PARAM,			&reg_active_param      },
+	{"reg_gc_interval",		INT_PARAM,	&_uac_reg_gc_interval	},
 	{0, 0, 0}
 };
 
diff --git a/src/modules/uac/uac_reg.c b/src/modules/uac/uac_reg.c
index f75c7cf38a..dfc595f020 100644
--- a/src/modules/uac/uac_reg.c
+++ b/src/modules/uac/uac_reg.c
@@ -58,9 +58,10 @@
 #define UAC_REG_INIT		(1<<4) /* registration initialized */
 
 #define MAX_UACH_SIZE 2048
-#define UAC_REG_GC_INTERVAL	150
 #define UAC_REG_TM_CALLID_SIZE 90
 
+int _uac_reg_gc_interval = 150;
+
 typedef struct _reg_uac
 {
 	unsigned int h_uuid;
@@ -423,9 +424,10 @@ int uac_reg_ht_shift(void)
 	tn = time(NULL);
 
 	lock_get(_reg_htable_gc_lock);
-	if(_reg_htable_gc->stime > tn-UAC_REG_GC_INTERVAL) {
+	if(_reg_htable_gc->stime > tn - _uac_reg_gc_interval) {
 		lock_release(_reg_htable_gc_lock);
-		LM_ERR("shifting the memory table is not possible in less than %d secs\n", UAC_REG_GC_INTERVAL);
+		LM_ERR("shifting in-memory table is not possible in less than %d secs\n",
+				_uac_reg_gc_interval);
 		return -1;
 	}
 	uac_reg_reset_ht_gc();
@@ -1224,7 +1226,7 @@ void uac_reg_timer(unsigned int ticks)
 	{
 		lock_get(_reg_htable_gc_lock);
 		if(_reg_htable_gc->stime!=0
-				&& _reg_htable_gc->stime < tn - UAC_REG_GC_INTERVAL)
+				&& _reg_htable_gc->stime < tn - _uac_reg_gc_interval)
 			uac_reg_reset_ht_gc();
 		lock_release(_reg_htable_gc_lock);
 	}




More information about the sr-dev mailing list