[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r241713 - /team/group/CCSS_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 20 15:14:39 CST 2010


Author: mmichelson
Date: Wed Jan 20 15:14:38 2010
New Revision: 241713

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=241713
Log:
Remove a bunch of code that is no longer executed.


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

Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=241713&r1=241712&r2=241713
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Wed Jan 20 15:14:38 2010
@@ -927,7 +927,6 @@
 };
 
 static int cc_butt_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
-static int cc_extension_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_extension_monitor_status_response(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
 static int cc_extension_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_extension_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, const int core_id, int *sched_id);
@@ -937,7 +936,6 @@
 static struct ast_cc_monitor_callbacks extension_monitor_cbs = {
 	.type = "extension",
 	.init = cc_butt_extension_monitor_init,
-	.suspend = cc_extension_monitor_suspend,
 	.status_response = cc_extension_monitor_status_response,
 	.unsuspend = cc_extension_monitor_unsuspend,
 	.cancel_available_timer = cc_extension_monitor_cancel_available_timer,
@@ -947,21 +945,6 @@
 
 static int cc_butt_extension_monitor_init(struct ast_cc_monitor *monitor, const int core_id)
 {
-	return 0;
-}
-
-static int cc_extension_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
-{
-	struct ast_cc_monitor_link *link_iter;
-	AST_LIST_TRAVERSE(&monitor->child_links, link_iter, next_child) {
-		if (link_iter->core_id != core_id) {
-			continue;
-		}
-		ast_assert(link_iter->child != NULL);
-		ast_assert(link_iter->child->callbacks != NULL);
-		link_iter->is_suspended = 1;
-		link_iter->child->callbacks->suspend(link_iter->child, core_id);
-	}
 	return 0;
 }
 
@@ -1024,7 +1007,6 @@
 
 static int cc_generic_monitor_init(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_generic_monitor_request_cc2(struct cc_monitor *monitor, int *available_timer_id);
-static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id);
 static int cc_generic_monitor_suspend2(struct cc_monitor *monitor);
 static int cc_generic_monitor_status_response(struct ast_cc_monitor *monitor, const int core_id, enum ast_device_state devstate);
 static int cc_generic_monitor_unsuspend(struct ast_cc_monitor *monitor, const int core_id);
@@ -1036,7 +1018,6 @@
 	.type = "generic",
 	.init = cc_generic_monitor_init,
 	.request_cc2 = cc_generic_monitor_request_cc2,
-	.suspend = cc_generic_monitor_suspend,
 	.suspend2 = cc_generic_monitor_suspend2,
 	.status_response = cc_generic_monitor_status_response,
 	.unsuspend = cc_generic_monitor_unsuspend,
@@ -1298,22 +1279,6 @@
 		}
 	}
 	cc_unref(generic_list, "Done with generic list in suspend callback");
-	return 0;
-}
-
-static int cc_generic_monitor_suspend(struct ast_cc_monitor *monitor, const int core_id)
-{
-	if (monitor->saved_link && monitor->saved_link->core_id == core_id) {
-		/* The link we signaled availability on has become suspended. We need
-		 * to NULL out our saved link in this case no matter what, and if the device
-		 * is available, we need call the function to announce availability in case
-		 * there is another link on which we may announce the availability.
-		 */
-		monitor->saved_link = NULL;
-		if (ast_device_state(monitor->interface->name) == AST_DEVICE_NOT_INUSE) {
-			ast_cc_monitor_callee_available(monitor);
-		}
-	}
 	return 0;
 }
 
@@ -2468,127 +2433,6 @@
 	finder.interface = finder_interface;
 
 	return ao2_t_find(cc_monitors, &finder, OBJ_POINTER, "Trying to find specific monitor");
-}
-
-/*!
- * \internal
- * \brief pass a state change up the monitor tree
- *
- * When a device monitor has had a state change, it will try
- * to find the proper upstream link to report on. This is the
- * function which is called to do so. Unless there was
- * some terrible construction error, the monitor passed to this
- * function will always be an extension monitor or the root monitor.
- * Extension monitors will check the state machine to see what the
- * current state is. If the state is one where getting the monitored
- * device's status would be useful, then the extension monitor will
- * report it upstream.
- *
- * If the root monitor should be notified of a status change, then this
- * means that the state change has been screened to the point that
- * the core should be alerted of it. The root monitor will request a
- * core state machine change to the CC_CALLEE_READY state
- *
- * Note of course that only state changes for AVAILABILITY are passed
- * upstream. There is no need to pass along the fact that a phone has
- * become busy.
- */
-static int pass_availability_up(struct ast_cc_monitor *monitor, int core_id)
-{
-	struct cc_core_instance *core_instance;
-	struct ast_cc_monitor_link *link;
-	ast_assert(monitor->interface->monitor_class == AST_CC_EXTENSION_MONITOR ||
-			monitor->interface->monitor_class == AST_CC_ROOT_MONITOR);
-
-	if (!(core_instance = find_cc_core_instance(core_id))) {
-		return -1;
-	}
-
-	if (monitor->interface->monitor_class == AST_CC_ROOT_MONITOR) {
-		cc_unref(core_instance, "Unref core_instance from earlier ao2_find");
-		cc_request_state_change(CC_CALLEE_READY, core_id, "Device being monitored has become available");
-		return 0;
-	}
-
-	/* Oh, so you're an extension monitor, are you?!
-	 *
-	 * Extension monitors may have multiple children with the same core_id,
-	 * but they SHOULD have only a single parent with that core_id.
-	 */
-	AST_LIST_TRAVERSE(&monitor->parent_links, link, next_parent) {
-		if (link->core_id == core_id) {
-			break;
-		}
-	}
-
-	if (!link) {
-		ast_log(LOG_WARNING, "Monitor %s has no parent link with core_id %d but it had a child. That should be impossible\n",
-				monitor->interface->name, core_id);
-		return -1;
-	}
-
-	pass_availability_up(link->parent, core_id);
-	cc_unref(core_instance, "Unref core_instance from earlier ao2_find");
-
-	return 0;
-}
-
-/*!
- * \internal
- * \brief process a reported device state change from a monitor
- *
- * Since this executes in the core taskprocessor thread,
- * there is no need to worry about doing any locking of
- * lists or links.
- *
- * Note that the monitor passed to this function has had
- * its refcount increased by ast_cc_callee_available,
- * so it is essential that the refcount is decremented prior
- * to returning.
- *
- * \param datap pointer to the monitor reporting the state change
- */
-static int cc_devstate_change(void *datap)
-{
-	struct ast_cc_monitor *monitor = datap;
-	struct ast_cc_monitor_link *link = monitor->saved_link;
-
-	if (link && !link->is_suspended) {
-		pass_availability_up(link->parent, link->core_id);
-		cc_unref(monitor, "Kill reference from ast_cc_callee_available");
-		return 0;
-	}
-
-	/* Since links are established chronologically, and new links are
-	 * appended to the end of the list, the list is automatically sorted
-	 * with the higher priority links at the front and the lower
-	 * priority links at the back.
-	 */
-	AST_LIST_TRAVERSE(&monitor->parent_links, link, next_parent) {
-		if (!link->is_suspended) {
-			ast_log_dynamic_level(cc_logger_level, "Selected link with core_id %d for passing up availability\n", link->core_id);
-			break;
-		}
-	}
-
-	if (!link) {
-		/* Either there are no upstream links, or all upstream links
-		 * are suspended. Either way, this isn't a particularly big
-		 * deal.
-		 */
-		cc_unref(monitor, "Kill reference from ast_cc_callee_available");
-		return 0;
-	}
-
-	monitor->saved_link = link;
-	manager_event(EVENT_FLAG_CC, "CCCalleeAvailable",
-		"CoreID: %d\r\n"
-		"Callee: %s\r\n",
-		link->core_id, monitor->interface->name
-	);
-	pass_availability_up(link->parent, link->core_id);
-	cc_unref(monitor, "Kill reference from ast_cc_callee_available");
-	return 0;
 }
 
 struct cc_state_change_args {
@@ -3195,18 +3039,6 @@
 	return cc_request_state_change(CC_CALLEE_READY, monitor->core_id, "Device being monitored has become available");
 }
 
-int ast_cc_monitor_callee_available(struct ast_cc_monitor *monitor)
-{
-	int res;
-
-	res = ast_taskprocessor_push(cc_core_taskprocessor, cc_devstate_change,
-		cc_ref(monitor, "Bump reference count until cc_devstate_change executes"));
-	if (res) {
-		cc_unref(monitor, "Kill reference from ast_cc_monitor_callee_available");
-	}
-	return res;
-}
-
 int ast_cc_agent_caller_busy(int core_id, const char * debug)
 {
 	return cc_request_state_change(CC_CALLER_BUSY, core_id, debug);




More information about the asterisk-commits mailing list