[sr-dev] git:master:29eb7561: rr: use msg_ctx_id_t for caching of request direction

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 13 16:41:36 CEST 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-08-13T16:38:04+02:00

rr: use msg_ctx_id_t for caching of request direction

---

Modified: src/modules/rr/loose.c

---

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

---

diff --git a/src/modules/rr/loose.c b/src/modules/rr/loose.c
index 37fa04f33d..fed7cc7140 100644
--- a/src/modules/rr/loose.c
+++ b/src/modules/rr/loose.c
@@ -1218,12 +1218,12 @@ int get_route_param(sip_msg_t *msg, str *name, str *val)
 int is_direction(struct sip_msg * msg, int dir)
 {
 	static str ftag_param = {"ftag",4};
-	static unsigned int last_id = (unsigned int)-1;
+	static msg_ctx_id_t last_id = {0};
 	static unsigned int last_dir = 0;
 	str ftag_val;
 	str tag;
 
-	if ( last_id==msg->id && last_dir!=0) {
+	if ( last_id.msgid==msg->id && last_id.pid==msg->pid && last_dir!=0) {
 		if (last_dir==RR_FLOW_UPSTREAM)
 			goto upstream;
 		else
@@ -1256,11 +1256,13 @@ int is_direction(struct sip_msg * msg, int dir)
 		goto upstream;
 
 downstream:
-	last_id = msg->id;
+	last_id.msgid = msg->id;
+	last_id.pid = msg->pid;
 	last_dir = RR_FLOW_DOWNSTREAM;
 	return (dir==RR_FLOW_DOWNSTREAM)?0:-1;
 upstream:
-	last_id = msg->id;
+	last_id.msgid = msg->id;
+	last_id.pid = msg->pid;
 	last_dir = RR_FLOW_UPSTREAM;
 	return (dir==RR_FLOW_UPSTREAM)?0:-1;
 }




More information about the sr-dev mailing list