[asterisk-commits] mmichelson: branch group/CCSS r215889 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 3 07:57:01 CDT 2009
Author: mmichelson
Date: Thu Sep 3 07:56:58 2009
New Revision: 215889
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215889
Log:
Begin writing process for pruning the tree when a CC
transaction completes or fails.
Modified:
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=215889&r1=215888&r2=215889
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Sep 3 07:56:58 2009
@@ -938,6 +938,36 @@
int core_id;
char debug[1];
};
+
+static void destroy_link(struct ast_cc_monitor_link *link)
+{
+ /* STUB */
+ return;
+}
+
+static void prune_links(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *link_parent)
+{
+ struct ast_cc_monitor_link *link_iter;
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&monitor->child_links, link_iter, next) {
+ if (link_iter->core_id == core_id) {
+ prune_links(link_iter->child, core_id, link_iter);
+ AST_LIST_REMOVE_CURRENT(next);
+ destroy_link(link_iter);
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+
+ if (link_parent) {
+ AST_LIST_REMOVE(&monitor->parent_links, link_parent, next);
+ }
+ if (AST_LIST_EMPTY(&monitor->parent_links) &&
+ AST_LIST_EMPTY(&monitor->child_links)) {
+ /* This should cause the monitor's destructor
+ * callback to be called
+ */
+ ao2_unlink(cc_monitors, monitor);
+ }
+}
static int cc_do_state_change(void *datap)
{
@@ -1025,6 +1055,7 @@
case CC_FAILED:
/* Something along the way failed, call agent and monitor destructor functions
*/
+ prune_links(core_instance->monitor, core_instance->core_id, NULL);
break;
default:
ast_log(LOG_WARNING, "Asked to change to non-existent state %d. Ignoring\n", args->state);
More information about the asterisk-commits
mailing list