Module: kamailio Branch: master Commit: 47b1b56e6cf86b2b6d74fdf4f292e8f2bf87f9fd URL: https://github.com/kamailio/kamailio/commit/47b1b56e6cf86b2b6d74fdf4f292e8f2...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-04-05T11:37:06+02:00
dmq: fixes for changes in the 678f9c6ad8a8118741a921fcc01f9b23b5702c6e
- init the next field to first notification address str_list_t item - init local variables to avoid compile warnings on using garbage value - while condition on server_list instead of address of its ->s field (which always not null) - do not iterate using global dmq_notification_address_list variable, it shifts it till becomes NULL
---
Modified: src/modules/dmq/dmq.c Modified: src/modules/dmq/notification_peer.c
---
Diff: https://github.com/kamailio/kamailio/commit/47b1b56e6cf86b2b6d74fdf4f292e8f2... Patch: https://github.com/kamailio/kamailio/commit/47b1b56e6cf86b2b6d74fdf4f292e8f2...
---
diff --git a/src/modules/dmq/dmq.c b/src/modules/dmq/dmq.c index 79cc8ccbc9..27e950e472 100644 --- a/src/modules/dmq/dmq.c +++ b/src/modules/dmq/dmq.c @@ -387,6 +387,7 @@ static int dmq_add_notification_address(modparam_t type, void * val) } dmq_tmp_list = dmq_notification_address_list; dmq_tmp_list->s = tmp_str; + dmq_tmp_list->next = NULL; } else { dmq_tmp_list = append_str_list(tmp_str.s, tmp_str.len, &dmq_tmp_list, &total_list); if (dmq_tmp_list == NULL) { diff --git a/src/modules/dmq/notification_peer.c b/src/modules/dmq/notification_peer.c index ff8886d0ab..d40fd2cac2 100644 --- a/src/modules/dmq/notification_peer.c +++ b/src/modules/dmq/notification_peer.c @@ -284,7 +284,7 @@ dmq_node_t *add_server_and_notify(str_list_t *server_list) { char puri_data[MAXDMQHOSTS * (MAXDMQURILEN + 1)]; char *puri_list[MAXDMQHOSTS]; - dmq_node_t *pfirst, *pnode; + dmq_node_t *pfirst = NULL, *pnode = NULL; int host_cnt, index; sip_uri_t puri[1]; str pstr[1]; @@ -296,7 +296,7 @@ dmq_node_t *add_server_and_notify(str_list_t *server_list) **********/
if(!dmq_multi_notify) { - while (&server_list->s != NULL) { + while (server_list != NULL) { LM_DBG("adding notification node %.*s\n", server_list->s.len, server_list->s.s); pfirst = add_dmq_node(dmq_node_list, &server_list->s); @@ -592,6 +592,7 @@ int notification_resp_callback_f( { int ret; int nodes_recv; + str_list_t *slp;
LM_DBG("notification_callback_f triggered [%p %d %p]\n", msg, code, param); if(code == 200) { @@ -605,15 +606,16 @@ int notification_resp_callback_f( } } else if(code == 408) { /* TODO this probably do not work for dmq_multi_notify */ - while (&dmq_notification_address_list->s != NULL) { - if(STR_EQ(node->orig_uri, dmq_notification_address_list->s)) { + slp = dmq_notification_address_list; + while (slp != NULL) { + if(STR_EQ(node->orig_uri, slp->s)) { LM_ERR("not deleting notification peer [%.*s]\n", - STR_FMT(&dmq_notification_address_list->s)); + STR_FMT(&slp->s)); update_dmq_node_status(dmq_node_list, node, DMQ_NODE_PENDING); return 0; } - dmq_notification_address_list = dmq_notification_address_list->next; - } + slp = slp->next; + } if (node->status == DMQ_NODE_DISABLED) { /* deleting node - the server did not respond */ LM_ERR("deleting server node %.*s because of failed request\n",