Module: kamailio
Branch: 5.4
Commit: f61d7a1b6b45bbed29bf4bc6c8a69fd52700ca41
URL:
https://github.com/kamailio/kamailio/commit/f61d7a1b6b45bbed29bf4bc6c8a69fd…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-19T13:28:53+01:00
tm: use q field comparison in while for standard t contacts load
- fix ordering change to standar mode introduced with proportional mode
- GH #2449
(cherry picked from commit 59f6ddbe902d61bc682dd12fc6330df656468b1b)
---
Modified: src/modules/tm/t_serial.c
---
Diff:
https://github.com/kamailio/kamailio/commit/f61d7a1b6b45bbed29bf4bc6c8a69fd…
Patch:
https://github.com/kamailio/kamailio/commit/f61d7a1b6b45bbed29bf4bc6c8a69fd…
---
diff --git a/src/modules/tm/t_serial.c b/src/modules/tm/t_serial.c
index d27a648243..13611cdb54 100644
--- a/src/modules/tm/t_serial.c
+++ b/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;