Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dispatcher: Call load distribution forces maxload attribute #800

Closed
cruzccl opened this issue Sep 27, 2016 · 1 comment
Closed

dispatcher: Call load distribution forces maxload attribute #800

cruzccl opened this issue Sep 27, 2016 · 1 comment

Comments

@cruzccl
Copy link
Contributor

cruzccl commented Sep 27, 2016

Hi Daniel,

I am using call load distribution algorithm calling ds_select_dst function with '10' as second argument, as described in dispatcher module doc files.

The problem I notice is that all gateways without maxload attribute are discarded, even though the documentation says that if maxload is set to 0, no active call limit is used. The same thing happens if I set maxload to 0.

Reading the code I think the problem is in ds_get_leastloaded function in dispatch.c file.

This is the patch I have used:

diff --git a/modules/dispatcher/dispatch.c b/modules/dispatcher/dispatch.c
index c1a831b..1e0064d 100644
--- a/modules/dispatcher/dispatch.c
+++ b/modules/dispatcher/dispatch.c
@@ -1449,7 +1449,8 @@ int ds_get_leastloaded(ds_set_t *dset)
    for(j=0; j<dset->nr; j++)
    {
        if(!ds_skip_dst(dset->dlist[j].flags)
-               && dset->dlist[j].dload<dset->dlist[j].attrs.maxload)
+               && (dset->dlist[j].attrs.maxload == 0
+                || dset->dlist[j].dload < dset->dlist[j].attrs.maxload))
        {
            if(dset->dlist[j].dload<t)
            {

I have done my tests with this version:

# kamailio -v
version: kamailio 4.4.3 (x86_64/linux) e43d82-dirty
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: e43d82 -dirty
compiled on 12:38:36 Sep 27 2016 with gcc 4.7.2

Thank you and regards,

miconda added a commit that referenced this issue Sep 28, 2016
- reported and patch by Carlos Cruz Luengo, GH #800
miconda added a commit that referenced this issue Sep 28, 2016
- reported and patch by Carlos Cruz Luengo, GH #800

(cherry picked from commit a0521f7)
@miconda
Copy link
Member

miconda commented Sep 28, 2016

Thanks! Fix pushed to master and 4.4 branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants