Module: kamailio
Branch: master
Commit: 94068d2e40eb867a5d6da44868d5edb52949f817
URL:
https://github.com/kamailio/kamailio/commit/94068d2e40eb867a5d6da44868d5edb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-04-22T08:36:11+02:00
dmq: skip removing local node via rpc command
---
Modified: src/modules/dmq/dmqnode.c
---
Diff:
https://github.com/kamailio/kamailio/commit/94068d2e40eb867a5d6da44868d5edb…
Patch:
https://github.com/kamailio/kamailio/commit/94068d2e40eb867a5d6da44868d5edb…
---
diff --git a/src/modules/dmq/dmqnode.c b/src/modules/dmq/dmqnode.c
index 631dce11d5..4300f80b54 100644
--- a/src/modules/dmq/dmqnode.c
+++ b/src/modules/dmq/dmqnode.c
@@ -328,9 +328,12 @@ void pkg_free_node(dmq_node_t *node)
}
/**
- * @brief delete dmq node
+ * @brief delete dmq node with filter rules
+ * - list - the list of nodes
+ * - node - the structure with characteristics of the node to be deleted
+ * - filter - if 0: delete node always; if 1: delete node if not local
*/
-int del_dmq_node(dmq_node_list_t *list, dmq_node_t *node)
+int dmq_node_del_filter(dmq_node_list_t *list, dmq_node_t *node, int filter)
{
dmq_node_t *cur, **prev;
lock_get(&list->lock);
@@ -338,8 +341,10 @@ int del_dmq_node(dmq_node_list_t *list, dmq_node_t *node)
prev = &list->nodes;
while(cur) {
if(cmp_dmq_node(cur, node)) {
- *prev = cur->next;
- destroy_dmq_node(cur, 1);
+ if(filter==0 || cur->local==0) {
+ *prev = cur->next;
+ destroy_dmq_node(cur, 1);
+ }
lock_release(&list->lock);
return 1;
}
@@ -350,6 +355,14 @@ int del_dmq_node(dmq_node_list_t *list, dmq_node_t *node)
return 0;
}
+/**
+ * @brief delete dmq node
+ */
+int del_dmq_node(dmq_node_list_t *list, dmq_node_t *node)
+{
+ return dmq_node_del_filter(list, node, 0);
+}
+
/**
* @brief delete dmq node by uri
*/
@@ -363,7 +376,7 @@ int dmq_node_del_by_uri(dmq_node_list_t *list, str *suri)
return -1;
}
- return del_dmq_node(list, &dnode);
+ return dmq_node_del_filter(list, &dnode, 1);
}
/**