[svn-commits] mmichelson: branch group/CCSS r214648 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 28 13:23:28 CDT 2009


Author: mmichelson
Date: Fri Aug 28 13:23:25 2009
New Revision: 214648

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214648
Log:
Fix some bad logic used in scheduler timing.

In my next commit, I will be switching to the
sched_thread API since I need a thread to do
the work of running the callbacks for me.


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

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=214648&r1=214647&r2=214648
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Aug 28 13:23:25 2009
@@ -86,6 +86,10 @@
 	 * determine when we may move on
 	 */
 	struct ast_event_sub *sub;
+	/*!
+	 * Scheduler id of offer timer.
+	 */
+	int offer_timer_id;
 	/* XXX Potentially more to come...
 	 */
 };
@@ -653,6 +657,7 @@
 static int offer_timer_expire(const void *data)
 {
 	const struct ast_cc_agent *agent = data;
+	ast_log(LOG_NOTICE, "Hello?\n");
 	ast_cc_request_state_change(CC_FAILED, agent->core_id, "Generic agent offer timer expired");
 	return 0;
 }
@@ -660,12 +665,19 @@
 static int cc_generic_agent_start_offer_timer(struct ast_cc_agent *agent)
 {
 	int when;
+	int sched_id;
+	struct cc_generic_agent_pvt *generic_pvt = agent->private_data;
 
 	ast_assert(cc_sched != NULL);
 	ast_assert(agent->cc_params != NULL);
 
 	when = ast_get_cc_offer_timer(agent->cc_params) * 1000;
-	return ast_sched_add(cc_sched, when, offer_timer_expire, agent);
+	ast_log(LOG_NOTICE, "About to schedule timer expiration for %d ms\n", when);
+	if ((sched_id = ast_sched_add(cc_sched, when, offer_timer_expire, agent)) == -1) {
+		return -1;
+	}
+	generic_pvt->offer_timer_id = sched_id;
+	return 0;
 }
 
 static void cc_generic_agent_ack(struct ast_cc_agent *agent)




More information about the svn-commits mailing list