[svn-commits] mmichelson: branch group/CCSS r228014 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 5 10:59:49 CST 2009


Author: mmichelson
Date: Thu Nov  5 10:59:45 2009
New Revision: 228014

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=228014
Log:
Fix a logic error in cc_extension_monitor_request_cc.

The old logic would see if the list of child monitors was
empty in order to determine the return value. This is not
correct, though, since an extension monitor may be involved
in multiple calls. Instead, we need to return failure if
all of the child monitors on whom we called the request_cc
callback failed.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=228014&r1=228013&r2=228014
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Nov  5 10:59:45 2009
@@ -834,6 +834,7 @@
 static int cc_extension_monitor_request_cc(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *parent_link)
 {
 	struct ast_cc_monitor_link *link_iter;
+	int all_children_failed = 1;
 	AST_LIST_TRAVERSE(&monitor->child_links, link_iter, next_child) {
 		if (link_iter->core_id != core_id) {
 			continue;
@@ -842,14 +843,17 @@
 		ast_assert(link_iter->child->callbacks != NULL);
 		if (link_iter->child->callbacks->request_cc(link_iter->child, core_id, link_iter)) {
 			prune_links(link_iter->child, core_id, link_iter);
-		} else if (link_iter->child->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
-			manager_event(EVENT_FLAG_CC, "CCRequestSent",
-				"CoreID: %d\r\n"
-				"Callee: %s\r\n",
-				link_iter->core_id, link_iter->child->interface->name);
+		} else {
+			all_children_failed = 0;
+			if (link_iter->child->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
+				manager_event(EVENT_FLAG_CC, "CCRequestSent",
+					"CoreID: %d\r\n"
+					"Callee: %s\r\n",
+					link_iter->core_id, link_iter->child->interface->name);
+			}
 		}
 	}
-	if (AST_LIST_EMPTY(&monitor->child_links)) {
+	if (all_children_failed) {
 		/* None of the child monitors successfully requested
 		 * CC, and so all of the child links were pruned. If this
 		 * is an extension monitor, just return -1. If this is the




More information about the svn-commits mailing list