[sr-dev] git:master:28224ba2: sl: Convert get_ticks() to the somewhat faster get_ticks_raw()
Alex Hermann
alex at speakup.nl
Tue Aug 30 13:51:43 CEST 2016
Module: kamailio
Branch: master
Commit: 28224ba2da2cc111239c173bedfcc4a7c295f394
URL: https://github.com/kamailio/kamailio/commit/28224ba2da2cc111239c173bedfcc4a7c295f394
Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date: 2016-08-05T15:07:11+02:00
sl: Convert get_ticks() to the somewhat faster get_ticks_raw()
Avoid a multiplication on every call.
---
Modified: modules/sl/sl_funcs.c
Modified: modules/sl/sl_funcs.h
---
Diff: https://github.com/kamailio/kamailio/commit/28224ba2da2cc111239c173bedfcc4a7c295f394.diff
Patch: https://github.com/kamailio/kamailio/commit/28224ba2da2cc111239c173bedfcc4a7c295f394.patch
---
diff --git a/modules/sl/sl_funcs.c b/modules/sl/sl_funcs.c
index ec5a2ba..ac7701c 100644
--- a/modules/sl/sl_funcs.c
+++ b/modules/sl/sl_funcs.c
@@ -86,7 +86,7 @@ int sl_startup()
LOG(L_ERR,"ERROR:sl_startup: no more free memory!\n");
return -1;
}
- *(sl_timeout)=get_ticks();
+ *(sl_timeout)=get_ticks_raw();
return 1;
}
@@ -182,7 +182,7 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)
sl_run_callbacks(SLCB_REPLY_READY, msg, code, reason, &buf, &dst);
- *(sl_timeout) = get_ticks() + SL_RPL_WAIT_TIME;
+ *(sl_timeout) = get_ticks_raw() + SL_RPL_WAIT_TIME;
/* supress multhoming support when sending a reply back -- that makes sure
that replies will come from where requests came in; good for NATs
@@ -383,7 +383,7 @@ int sl_filter_ACK(struct sip_msg *msg, unsigned int flags, void *bar )
goto pass_it;
/*check the timeout value*/
- if ( *(sl_timeout)<= get_ticks() )
+ if ( *(sl_timeout)<= get_ticks_raw() )
{
DBG("DEBUG : sl_filter_ACK: to late to be a local ACK!\n");
goto pass_it;
diff --git a/modules/sl/sl_funcs.h b/modules/sl/sl_funcs.h
index 4928fc9..077ad93 100644
--- a/modules/sl/sl_funcs.h
+++ b/modules/sl/sl_funcs.h
@@ -24,8 +24,9 @@
#include "../../sr_module.h"
#include "../../parser/msg_parser.h"
+#include "../../timer_ticks.h"
-#define SL_RPL_WAIT_TIME 2 /* in sec */
+#define SL_RPL_WAIT_TIME S_TO_TICKS(2) /* in sec */
#define SL_TOTAG_SEPARATOR '.'
More information about the sr-dev
mailing list