[asterisk-commits] mmichelson: branch group/CCSS r221160 - /team/group/CCSS/apps/app_dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 30 10:47:00 CDT 2009


Author: mmichelson
Date: Wed Sep 30 10:46:56 2009
New Revision: 221160

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221160
Log:
Prevent duplicate tree items from being created in the
scenario where a device queues multiple CC control frames.


Modified:
    team/group/CCSS/apps/app_dial.c

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=221160&r1=221159&r2=221160
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Wed Sep 30 10:46:56 2009
@@ -1890,6 +1890,23 @@
 
 	cc_interfaces = cc_datastore->data;
 
+	/* Yeah this kind of sucks, but luckily most people
+	 * aren't dialing thousands of interfaces on every call
+	 *
+	 * This traversal helps us to not create duplicate tree items in
+	 * case a device queues multiple CC control frames.
+	 */
+	AST_LIST_LOCK(cc_interfaces->interface_tree);
+	AST_LIST_TRAVERSE(cc_interfaces->interface_tree, tree_item, next) {
+		if (!strcmp(tree_item->interface->name, device_name)) {
+			ast_log(LOG_NOTICE, "Device %s sent us multiple CC control frames. Ignoring those beyond the first.\n", device_name);
+			AST_LIST_UNLOCK(cc_interfaces->interface_tree);
+			return;
+		}
+	}
+	AST_LIST_UNLOCK(cc_interfaces->interface_tree);
+
+
 	if (!(tree_item = cc_device_tree_item_init(device_name, strlen(device_name), cc_interfaces->dial_parent_id, cc_data))) {
 		ast_log(LOG_WARNING, "Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
 		return;




More information about the asterisk-commits mailing list