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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 3 09:59:58 CST 2010


Author: mmichelson
Date: Wed Feb  3 09:59:53 2010
New Revision: 244501

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244501
Log:
Use proper agent refcounting with regards to the scheduling the offer timer.


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=244501&r1=244500&r2=244501
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Wed Feb  3 09:59:53 2010
@@ -2026,6 +2026,7 @@
 	struct cc_generic_agent_pvt *agent_pvt = agent->private_data;
 	ast_log_dynamic_level(cc_logger_level, "Queuing change request because offer timer has expired.\n");
 	agent_pvt->offer_timer_id = -1;
+	cc_unref(agent, "Remove scheduler's reference to the agent");
 	ast_cc_failed(agent->core_id, "Generic agent offer timer expired");
 	return 0;
 }
@@ -2041,7 +2042,7 @@
 
 	when = ast_get_cc_offer_timer(agent->cc_params) * 1000;
 	ast_log_dynamic_level(cc_logger_level, "About to schedule offer timer expiration for %d ms\n", when);
-	if ((sched_id = ast_sched_thread_add(cc_sched_thread, when, offer_timer_expire, agent)) == -1) {
+	if ((sched_id = ast_sched_thread_add(cc_sched_thread, when, offer_timer_expire, cc_ref(agent, "Give scheduler an agent ref"))) == -1) {
 		return -1;
 	}
 	generic_pvt->offer_timer_id = sched_id;
@@ -2055,6 +2056,7 @@
 	if (generic_pvt->offer_timer_id != -1) {
 		ast_sched_thread_del(cc_sched_thread, generic_pvt->offer_timer_id);
 		generic_pvt->offer_timer_id = -1;
+		cc_unref(agent, "Remove scheduler's reference to the agent");
 	}
 	return 0;
 }




More information about the asterisk-commits mailing list