Ver código fonte

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 4 anos atrás
pai
commit
59f6ddbe90
1 arquivos alterados com 14 adições e 5 exclusões
  1. 14 5
      src/modules/tm/t_serial.c

+ 14 - 5
src/modules/tm/t_serial.c

@@ -459,11 +459,20 @@ int ki_t_load_contacts_mode(struct sip_msg* msg, int mode)
 
 		prev = (struct contact *)0;
 		curr = contacts;
-		while (curr &&
-				((curr->q_index < next->q_index) ||
-				 ((curr->q_index == next->q_index) && (next->path.len == 0)))) {
-			prev = curr;
-			curr = curr->next;
+		if (mode == T_LOAD_PROPORTIONAL) {
+			while (curr &&
+					((curr->q_index < next->q_index) ||
+					 ((curr->q_index == next->q_index) && (next->path.len == 0)))) {
+				prev = curr;
+				curr = curr->next;
+			}
+		} else {
+			while (curr &&
+					((curr->q < next->q) ||
+					 ((curr->q == next->q) && (next->path.len == 0)))) {
+				prev = curr;
+				curr = curr->next;
+			}
 		}
 		if (!curr) {
 			next->next = (struct contact *)0;