Browse code

tm: use q field comparison in while for standard t contacts load

- fix ordering change to standar mode introduced with proportional mode
- GH #2449

Daniel-Constantin Mierla authored on 18/11/2020 13:04:15
Showing 1 changed files
... ...
@@ -459,11 +459,20 @@ int ki_t_load_contacts_mode(struct sip_msg* msg, int mode)
459 459
 
460 460
 		prev = (struct contact *)0;
461 461
 		curr = contacts;
462
-		while (curr &&
463
-				((curr->q_index < next->q_index) ||
464
-				 ((curr->q_index == next->q_index) && (next->path.len == 0)))) {
465
-			prev = curr;
466
-			curr = curr->next;
462
+		if (mode == T_LOAD_PROPORTIONAL) {
463
+			while (curr &&
464
+					((curr->q_index < next->q_index) ||
465
+					 ((curr->q_index == next->q_index) && (next->path.len == 0)))) {
466
+				prev = curr;
467
+				curr = curr->next;
468
+			}
469
+		} else {
470
+			while (curr &&
471
+					((curr->q < next->q) ||
472
+					 ((curr->q == next->q) && (next->path.len == 0)))) {
473
+				prev = curr;
474
+				curr = curr->next;
475
+			}
467 476
 		}
468 477
 		if (!curr) {
469 478
 			next->next = (struct contact *)0;