[asterisk-commits] mmichelson: branch group/CCSS r253152 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 17 10:42:45 CDT 2010


Author: mmichelson
Date: Wed Mar 17 10:42:41 2010
New Revision: 253152

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253152
Log:
Fix a race condition found during testing Call completion.

If a single monitored device had two requests made to it, then it was
possible for a device state change to be "missed" after the first recall
has completed. The reason for this is that the generic_monitor_instance
for the first recall was still in the list of instances for the particular
device. The result was that when the device became available, we would signal
its availability to the incorrect core_id. This change fixes the problem
by adding an integer which is set immediately false once we signal an
availability change on the device.


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=253152&r1=253151&r2=253152
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Mar 17 10:42:41 2010
@@ -985,6 +985,7 @@
 struct generic_monitor_instance {
 	int core_id;
 	int is_suspended;
+	int monitoring;
 	AST_LIST_ENTRY(generic_monitor_instance) next;
 };
 
@@ -1111,7 +1112,8 @@
 			(previous_state == AST_DEVICE_INUSE || previous_state == AST_DEVICE_UNAVAILABLE ||
 			 previous_state == AST_DEVICE_BUSY)) {
 		AST_LIST_TRAVERSE(&generic_list->list, generic_instance, next) {
-			if (!generic_instance->is_suspended) {
+			if (!generic_instance->is_suspended && generic_instance->monitoring) {
+				generic_instance->monitoring = 0;
 				ast_cc_monitor_callee_available(generic_instance->core_id, "Generic monitored party has become available");
 				break;
 			}
@@ -1197,6 +1199,7 @@
 		return -1;
 	}
 	generic_instance->core_id = monitor->core_id;
+	generic_instance->monitoring = 1;
 	AST_LIST_INSERT_TAIL(&generic_list->list, generic_instance, next);
 	when = service == AST_CC_CCBS ? ast_get_ccbs_available_timer(monitor->interface->config_params) :
 		ast_get_ccnr_available_timer(monitor->interface->config_params);
@@ -1284,6 +1287,7 @@
 	AST_LIST_TRAVERSE(&generic_list->list, generic_instance, next) {
 		if (generic_instance->core_id == monitor->core_id) {
 			generic_instance->is_suspended = 0;
+			generic_instance->monitoring = 1;
 			break;
 		}
 	}




More information about the asterisk-commits mailing list