[sr-dev] git:master:d2f695d6: sl: Reset timeout before sending the message

Alex Hermann alex at speakup.nl
Tue Aug 30 13:51:42 CEST 2016


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

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date: 2016-08-05T15:07:03+02:00

sl: Reset timeout before sending the message

Fix a common race where the reply would arrive before resetting the timeout.

---

Modified: modules/sl/sl_funcs.c

---

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

---

diff --git a/modules/sl/sl_funcs.c b/modules/sl/sl_funcs.c
index a65a7b8..ec5a2ba 100644
--- a/modules/sl/sl_funcs.c
+++ b/modules/sl/sl_funcs.c
@@ -182,6 +182,8 @@ 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;
+
 	/* supress multhoming support when sending a reply back -- that makes sure
 	   that replies will come from where requests came in; good for NATs
 	   (there is no known use for mhomed for locally generated replies;
@@ -286,8 +288,6 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)
 	if (ret<0) {
 		goto error;
 	}
-	
-	*(sl_timeout) = get_ticks() + SL_RPL_WAIT_TIME;
 
 	update_sl_stats(code);
 	return 1;




More information about the sr-dev mailing list