Browse code

Merge pull request #1954 from omnicate/master

ims_qos: use msg_ctx_id_t to detect same msg/transaction processing

Daniel-Constantin Mierla authored on 15/05/2019 16:33:43
Showing 1 changed files
... ...
@@ -153,9 +153,9 @@ struct _pv_req_data {
153 153
 		struct cell *T;
154 154
 		struct sip_msg msg;
155 155
 		struct sip_msg *tmsgp;
156
-		unsigned int id;
157 156
 		char *buf;
158 157
 		int buf_size;
158
+  msg_ctx_id_t msg_ctx;
159 159
 };
160 160
 
161 161
 static struct _pv_req_data _pv_treq;
... ...
@@ -736,8 +736,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int
736 736
 			(which we cannot assume) then we would pollute the shm_msg t->uas.request if we did any parsing on it. Instead, we need to 
737 737
 			make a private copy of the message and free it when we are done 
738 738
 		 */
739
-		if ((_pv_treq.T != t || t->uas.request != _pv_treq.tmsgp)
740
-				&& t->uas.request->id != _pv_treq.id) {
739
+		if (msg_ctx_id_match(t->uas.request, &_pv_treq.msg_ctx) != 1) {
741 740
 
742 741
 				/* make a copy */
743 742
 				if (_pv_treq.buf == NULL || _pv_treq.buf_size < t->uas.request->len + 1) {
... ...
@@ -746,7 +745,8 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int
746 746
 						if (_pv_treq.tmsgp)
747 747
 								free_sip_msg(&_pv_treq.msg);
748 748
 						_pv_treq.tmsgp = NULL;
749
-						_pv_treq.id = 0;
749
+                                                _pv_treq.msg_ctx.msgid=0;
750
+                                                _pv_treq.msg_ctx.pid=0;
750 751
 						_pv_treq.T = NULL;
751 752
 						_pv_treq.buf_size = t->uas.request->len + 1;
752 753
 						_pv_treq.buf = (char*) pkg_malloc(_pv_treq.buf_size * sizeof(char));
... ...
@@ -764,7 +764,7 @@ static int w_rx_aar(struct sip_msg *msg, char *route, char* dir, char *c_id, int
764 764
 				_pv_treq.msg.len = t->uas.request->len;
765 765
 				_pv_treq.msg.buf = _pv_treq.buf;
766 766
 				_pv_treq.tmsgp = t->uas.request;
767
-				_pv_treq.id = t->uas.request->id;
767
+                                msg_ctx_id_set(t->uas.request, &_pv_treq.msg_ctx);
768 768
 				_pv_treq.T = t;
769 769
 
770 770