Browse code

tmx: use branch index for $T_rpl() cache invalidation

(cherry picked from commit e2ca5516ae086cf33c61dbb9e653a5484cca2074)

Daniel-Constantin Mierla authored on 13/11/2018 07:59:43
Showing 1 changed files
... ...
@@ -34,6 +34,7 @@
34 34
 struct _pv_tmx_data {
35 35
 	unsigned int index;
36 36
 	unsigned int label;
37
+	int branch;
37 38
 	struct sip_msg msg;
38 39
 	struct sip_msg *tmsgp;
39 40
 	char *buf;
... ...
@@ -175,7 +176,8 @@ int pv_t_update_rpl(struct sip_msg *msg)
175 176
 	if(t->uac[branch].reply==NULL || t->uac[branch].reply==FAKED_REPLY)
176 177
 		return 1;
177 178
 
178
-	if (_pv_trpl.label == t->label && _pv_trpl.index == t->hash_index)  
179
+	if (_pv_trpl.label == t->label && _pv_trpl.index == t->hash_index
180
+			&& _pv_trpl.branch == branch)
179 181
 		return 0;
180 182
 
181 183
 	/* make a copy */
... ...
@@ -188,6 +190,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
188 190
 		_pv_trpl.tmsgp = NULL;
189 191
 		_pv_trpl.index = 0;
190 192
 		_pv_trpl.label = 0;
193
+		_pv_trpl.branch = 0;
191 194
 		_pv_trpl.buf_size = t->uac[branch].reply->len+1;
192 195
 		_pv_trpl.buf = (char*)pkg_malloc(_pv_trpl.buf_size*sizeof(char));
193 196
 		if(_pv_trpl.buf==NULL)
... ...
@@ -207,6 +210,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
207 210
 	_pv_trpl.tmsgp = t->uac[branch].reply;
208 211
 	_pv_trpl.index = t->hash_index;
209 212
 	_pv_trpl.label = t->label;
213
+	_pv_trpl.branch = branch;
210 214
 
211 215
 	if(pv_t_copy_msg(t->uac[branch].reply, &_pv_trpl.msg)!=0)
212 216
 	{
... ...
@@ -216,6 +220,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
216 220
 		_pv_trpl.tmsgp = NULL;
217 221
 		_pv_trpl.index = 0;
218 222
 		_pv_trpl.label = 0;
223
+		_pv_trpl.branch = 0;
219 224
 		return -1;
220 225
 	}
221 226