Module: kamailio
Branch: 5.0
Commit: b30edd2b19d7e30c1d2f9cef9303ae86bcd1c0f2
URL:
https://github.com/kamailio/kamailio/commit/b30edd2b19d7e30c1d2f9cef9303ae8…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-04-04T13:52:37+02:00
dmq: attempt to re-initialize if node becomes detatched from cluster
- issue reported by José Seabra on sr-users mailing list
(cherry picked from commit 666ebb63aecf2254b8efeae261452fc75c6d3aed)
---
Modified: src/modules/dmq/dmq_funcs.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b30edd2b19d7e30c1d2f9cef9303ae8…
Patch:
https://github.com/kamailio/kamailio/commit/b30edd2b19d7e30c1d2f9cef9303ae8…
---
diff --git a/src/modules/dmq/dmq_funcs.c b/src/modules/dmq/dmq_funcs.c
index 57c8c88..622ec42 100644
--- a/src/modules/dmq/dmq_funcs.c
+++ b/src/modules/dmq/dmq_funcs.c
@@ -459,12 +459,28 @@ void ping_servers(unsigned int ticks, void *param) {
str* body;
int ret;
LM_DBG("ping_servers\n");
+
+ if (!node_list->nodes || (node_list->nodes->local &&
!node_list->nodes->next)) {
+ LM_DBG("node list is empty - attempt to rebuild from notification
address\n");
+ *dmq_init_callback_done = 0;
+ if(dmq_notification_address.s) {
+ notification_node = add_server_and_notify(&dmq_notification_address);
+ if(!notification_node) {
+ LM_ERR("cannot retrieve initial nodelist from %.*s\n",
+ STR_FMT(&dmq_notification_address));
+ }
+ } else {
+ LM_ERR("no notification address");
+ }
+ return;
+ }
+
body = build_notification_body();
if (!body) {
LM_ERR("could not build notification body\n");
return;
}
- ret = bcast_dmq_message(dmq_notification_peer, body, notification_node,
+ ret = bcast_dmq_message(dmq_notification_peer, body, NULL,
¬ification_callback, 1, ¬ification_content_type);
pkg_free(body->s);
pkg_free(body);