[asterisk-commits] mmichelson: branch group/CCSS r219894 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 23 10:41:49 CDT 2009
Author: mmichelson
Date: Wed Sep 23 10:41:46 2009
New Revision: 219894
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=219894
Log:
Clean up some comments.
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=219894&r1=219893&r2=219894
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Sep 23 10:41:46 2009
@@ -1100,27 +1100,16 @@
* 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_monitor_announce_availability,
+ * 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)
{
- /* Let's map this out a bit.
- The device being monitored has
- had a device state change.
-
- According to architecture doc, the device monitor
- should report the state change to a parent extension
- monitor. In choosing which one to report the change
- to, it should choose the lowest weighted unsuspended
- link. That's easy enough to find.
-
- It's important that once we have picked a link, we
- need to continue feeding information to that link
- until it goes away or becomes suspended. So the
- monitor is going to keep a pointer to whichever
- link it has chosen. This will change if the link
- gets destroyed or becomes suspended.
- */
struct ast_cc_monitor *monitor = datap;
struct ast_cc_monitor_link *link = monitor->saved_link;
@@ -1130,12 +1119,10 @@
return 0;
}
- /* Dang, we need to find the lowest weighted unsuspended
- link. Link weights are established at the time that CC
- requests are issued. Since weights increase chronologically
- and links are always added to the tail of the list, we
- know that links at the head are weighted lower than links
- at the end of the list.
+ /* 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) {
@@ -1144,17 +1131,14 @@
}
if (!link) {
- /* Hmm, all upstream links are suspended. Nothing wrong with
- that. It just means that there's no one to report this
- change to. Since we've saved the current state on the
- monitor, we'll be able to report this state upstream
- as soon as one of the links becomes unsuspended.
+ /* Either there are no upstream links, or all upstream links
+ * are suspended. Either way, this isn't a particularly big
+ * deal.
*/
ao2_t_ref(monitor, -1, "Kill reference from ast_cc_monitor_announce_availabilty");
return 0;
}
- /* We found a link to report on. Yay */
monitor->saved_link = link;
pass_availability_up(link->parent, link->core_id);
ao2_t_ref(monitor, -1, "Kill reference from ast_cc_monitor_announce_availabilty");
More information about the asterisk-commits
mailing list