Browse code

rr: use msg_ctx_id_t for caching of request direction

Daniel-Constantin Mierla authored on 13/08/2019 14:37:01
Showing 1 changed files
... ...
@@ -1218,12 +1218,12 @@ found:
1218 1218
 int is_direction(struct sip_msg * msg, int dir)
1219 1219
 {
1220 1220
 	static str ftag_param = {"ftag",4};
1221
-	static unsigned int last_id = (unsigned int)-1;
1221
+	static msg_ctx_id_t last_id = {0};
1222 1222
 	static unsigned int last_dir = 0;
1223 1223
 	str ftag_val;
1224 1224
 	str tag;
1225 1225
 
1226
-	if ( last_id==msg->id && last_dir!=0) {
1226
+	if ( last_id.msgid==msg->id && last_id.pid==msg->pid && last_dir!=0) {
1227 1227
 		if (last_dir==RR_FLOW_UPSTREAM)
1228 1228
 			goto upstream;
1229 1229
 		else
... ...
@@ -1256,11 +1256,13 @@ int is_direction(struct sip_msg * msg, int dir)
1256 1256
 		goto upstream;
1257 1257
 
1258 1258
 downstream:
1259
-	last_id = msg->id;
1259
+	last_id.msgid = msg->id;
1260
+	last_id.pid = msg->pid;
1260 1261
 	last_dir = RR_FLOW_DOWNSTREAM;
1261 1262
 	return (dir==RR_FLOW_DOWNSTREAM)?0:-1;
1262 1263
 upstream:
1263
-	last_id = msg->id;
1264
+	last_id.msgid = msg->id;
1265
+	last_id.pid = msg->pid;
1264 1266
 	last_dir = RR_FLOW_UPSTREAM;
1265 1267
 	return (dir==RR_FLOW_UPSTREAM)?0:-1;
1266 1268
 }