Browse Source

sl: Convert get_ticks() to the somewhat faster get_ticks_raw()

Avoid a multiplication on every call.
Alex Hermann 9 years ago
parent
commit
28224ba2da
2 changed files with 5 additions and 4 deletions
  1. 3 3
      modules/sl/sl_funcs.c
  2. 2 1
      modules/sl/sl_funcs.h

+ 3 - 3
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;

+ 2 - 1
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 '.'