From 28224ba2da2cc111239c173bedfcc4a7c295f394 Mon Sep 17 00:00:00 2001 From: Alex Hermann Date: Fri, 5 Aug 2016 14:53:31 +0200 Subject: [PATCH] sl: Convert get_ticks() to the somewhat faster get_ticks_raw() Avoid a multiplication on every call. --- modules/sl/sl_funcs.c | 6 +++--- modules/sl/sl_funcs.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/sl/sl_funcs.c b/modules/sl/sl_funcs.c index ec5a2baa4cb..ac7701c83c1 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 4928fc9cf37..077ad93a102 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 '.'