[asterisk-commits] russell: branch group/timing r122922 - in /team/group/timing: include/asteris...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 16 07:41:23 CDT 2008


Author: russell
Date: Mon Jun 16 07:41:22 2008
New Revision: 122922

URL: http://svn.digium.com/view/asterisk?view=rev&rev=122922
Log:
- convert a part of channel.c to the new timing API ... not sure how I missed this before
- fix a typo in a timing API function name

Modified:
    team/group/timing/include/asterisk/timing.h
    team/group/timing/main/channel.c
    team/group/timing/main/timing.c

Modified: team/group/timing/include/asterisk/timing.h
URL: http://svn.digium.com/view/asterisk/team/group/timing/include/asterisk/timing.h?view=diff&rev=122922&r1=122921&r2=122922
==============================================================================
--- team/group/timing/include/asterisk/timing.h (original)
+++ team/group/timing/include/asterisk/timing.h Mon Jun 16 07:41:22 2008
@@ -161,7 +161,7 @@
  * \retval -1 failure, with errno set
  * \retval 0 success
  */
-int ast_timer_disable_continous(int handle);
+int ast_timer_disable_continuous(int handle);
 
 /*!
  * \brief Determine timing event

Modified: team/group/timing/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/timing/main/channel.c?view=diff&rev=122922&r1=122921&r2=122922
==============================================================================
--- team/group/timing/main/channel.c (original)
+++ team/group/timing/main/channel.c Mon Jun 16 07:41:22 2008
@@ -2407,26 +2407,17 @@
 		read(chan->alertpipe[0], &blah, sizeof(blah));
 	}
 
-#ifdef HAVE_DAHDI
-	if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD && ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
-		int res;
+	if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD) {
+		enum ast_timing_event res;
 
 		ast_clear_flag(chan, AST_FLAG_EXCEPTION);
-		blah = -1;
-		/* IF we can't get event, assume it's an expired as-per the old interface */
-		res = ioctl(chan->timingfd, DAHDI_GETEVENT, &blah);
-		if (res)
-			blah = DAHDI_EVENT_TIMER_EXPIRED;
-
-		if (blah == DAHDI_EVENT_TIMER_PING) {
-			if (AST_LIST_EMPTY(&chan->readq) || !AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
-				/* Acknowledge PONG unless we need it again */
-				if (ioctl(chan->timingfd, DAHDI_TIMERPONG, &blah)) {
-					ast_log(LOG_WARNING, "Failed to pong timer on '%s': %s\n", chan->name, strerror(errno));
-				}
-			}
-		} else if (blah == DAHDI_EVENT_TIMER_EXPIRED) {
-			ioctl(chan->timingfd, DAHDI_TIMERACK, &blah);
+
+		res = ast_timer_get_event(chan->timingfd);
+
+		switch (res) {
+		case AST_TIMING_EVENT_EXPIRED:
+			ast_timer_ack(chan->timingfd, 1);
+
 			if (chan->timingfunc) {
 				/* save a copy of func/data before unlocking the channel */
 				int (*func)(const void *) = chan->timingfunc;
@@ -2434,18 +2425,22 @@
 				ast_channel_unlock(chan);
 				func(data);
 			} else {
-				blah = 0;
-				ioctl(chan->timingfd, DAHDI_TIMERCONFIG, &blah);
-				chan->timingdata = NULL;
+				ast_timer_set_rate(chan->timingfd, 0);
 				ast_channel_unlock(chan);
 			}
+
 			/* cannot 'goto done' because the channel is already unlocked */
 			return &ast_null_frame;
-		} else
-			ast_log(LOG_NOTICE, "No/unknown event '%d' on timer for '%s'?\n", blah, chan->name);
-	} else
-#endif
-	if (chan->fds[AST_GENERATOR_FD] > -1 && chan->fdno == AST_GENERATOR_FD) {
+
+		case AST_TIMING_EVENT_CONTINUOUS:
+			if (AST_LIST_EMPTY(&chan->readq) || 
+				!AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), frame_list)) {
+				ast_timer_disable_continuous(chan->timingfd);
+			}
+			break;
+		}
+
+	} else if (chan->fds[AST_GENERATOR_FD] > -1 && chan->fdno == AST_GENERATOR_FD) {
 		/* if the AST_GENERATOR_FD is set, call the generator with args
 		 * set to -1 so it can do whatever it needs to.
 		 */

Modified: team/group/timing/main/timing.c
URL: http://svn.digium.com/view/asterisk/team/group/timing/main/timing.c?view=diff&rev=122922&r1=122921&r2=122922
==============================================================================
--- team/group/timing/main/timing.c (original)
+++ team/group/timing/main/timing.c Mon Jun 16 07:41:22 2008
@@ -162,7 +162,7 @@
 	return result;
 }
 
-int ast_timer_disable_continous(int handle)
+int ast_timer_disable_continuous(int handle)
 {
 	int result;
 




More information about the asterisk-commits mailing list