[asterisk-commits] russell: branch russell/sla_updates r57007 -
/team/russell/sla_updates/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Feb 27 12:49:24 MST 2007
Author: russell
Date: Tue Feb 27 13:49:24 2007
New Revision: 57007
URL: http://svn.digium.com/view/asterisk?view=rev&rev=57007
Log:
Move processing station ring timeouts into a function
Modified:
team/russell/sla_updates/apps/app_meetme.c
Modified: team/russell/sla_updates/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_updates/apps/app_meetme.c?view=diff&rev=57007&r1=57006&r2=57007
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Tue Feb 27 13:49:24 2007
@@ -3528,20 +3528,16 @@
return res;
}
-/*! \brief Calculate the time until the next known event
- * \note Called with sla.lock locked */
-static int sla_process_timers(struct timespec *ts)
+/*! \brief Process station ring timeouts
+ * \note Called with sla.lock locked
+ * \return non-zero if a change to the ringing stations was made
+ */
+static int sla_calc_station_timeouts(unsigned int *timeout)
{
struct sla_ringing_trunk *ringing_trunk;
struct sla_ringing_station *ringing_station;
- unsigned int timeout = UINT_MAX;
- struct timeval tv;
- unsigned int change_made = 0;
-
- /* Check for ring timeouts on ringing trunks */
- change_made = sla_calc_trunk_timeouts(&timeout);
-
- /* Check for ring timeouts on ringing stations */
+ int res = 0;
+
AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) {
unsigned int ring_timeout = 0;
int time_elapsed, time_left, final_trunk_time_left = INT_MIN;
@@ -3591,18 +3587,35 @@
if (time_left <= 0) {
AST_LIST_REMOVE_CURRENT(&sla.ringing_stations, entry);
sla_stop_ringing_station(ringing_station, SLA_STATION_HANGUP_TIMEOUT);
- change_made = 1;
+ res = 1;
continue;
}
- if (time_left < timeout)
- timeout = time_left;
+ if (time_left < *timeout)
+ *timeout = time_left;
}
AST_LIST_TRAVERSE_SAFE_END
- /* Check for station ring delays. If there is a station that is currently
- * in the middle of a delay, then use that for the time to wake up. If we
- * come across stations that have a delay that is now over, make it start
- * ringing by just queueing reprocessing of ringing trunks. */
+ return res;
+}
+
+/*! \brief Calculate the time until the next known event
+ * \note Called with sla.lock locked */
+static int sla_process_timers(struct timespec *ts)
+{
+ unsigned int timeout = UINT_MAX;
+ struct timeval tv;
+ unsigned int change_made = 0;
+
+ /* Check for ring timeouts on ringing trunks */
+ if (sla_calc_trunk_timeouts(&timeout))
+ change_made = 1;
+
+ /* Check for ring timeouts on ringing stations */
+ if (sla_calc_station_timeouts(&timeout))
+ change_made = 1;
+
+ /* Check for station ring delays */
+ /* XXX */
/* queue reprocessing of ringing trunks */
if (change_made)
More information about the asterisk-commits
mailing list