Browse code

tm: Fix faked_reply_prio by passing correct reply to get_prio

Instead of passing the to be evaluated reply as the "best" reply, pass the
actual "best" reply.

(cherry picked from commit 5731cc0911ff65bf7efd433a83a25ffbf6073d10)

Alex Hermann authored on 13/11/2017 14:50:20 • Daniel-Constantin Mierla committed on 23/10/2020 08:58:26
Showing 1 changed files
... ...
@@ -1249,17 +1249,19 @@ inline static short int get_prio(unsigned int resp, struct sip_msg *rpl)
1249 1249
 int t_pick_branch(int inc_branch, int inc_code, struct cell *t, int *res_code)
1250 1250
 {
1251 1251
 	int best_b, best_s, b;
1252
-	sip_msg_t *rpl;
1252
+	sip_msg_t *rpl, *best_rpl;
1253 1253
 
1254 1254
 	best_b=-1; best_s=0;
1255
+	best_rpl=NULL;
1255 1256
 	for ( b=0; b<t->nr_of_outgoings ; b++ ) {
1256 1257
 		rpl = t->uac[b].reply;
1257 1258
 
1258 1259
 		/* "fake" for the currently processed branch */
1259 1260
 		if (b==inc_branch) {
1260
-			if (get_prio(inc_code, rpl)<get_prio(best_s, rpl)) {
1261
+			if (get_prio(inc_code, rpl)<get_prio(best_s, best_rpl)) {
1261 1262
 				best_b=b;
1262 1263
 				best_s=inc_code;
1264
+				best_rpl=rpl;
1263 1265
 			}
1264 1266
 			continue;
1265 1267
 		}
... ...
@@ -1275,9 +1277,10 @@ int t_pick_branch(int inc_branch, int inc_code, struct cell *t, int *res_code)
1275 1277
 			return -2;
1276 1278
 		/* if reply is null => t_send_branch "faked" reply, skip over it */
1277 1279
 		if ( rpl &&
1278
-				get_prio(t->uac[b].last_received, rpl)<get_prio(best_s, rpl) ) {
1280
+				get_prio(t->uac[b].last_received, rpl)<get_prio(best_s, best_rpl) ) {
1279 1281
 			best_b =b;
1280 1282
 			best_s = t->uac[b].last_received;
1283
+			best_rpl=rpl;
1281 1284
 		}
1282 1285
 	} /* find lowest branch */
1283 1286