[asterisk-commits] russell: branch russell/sla_updates r57006 -
/team/russell/sla_updates/apps/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Feb 27 12:42:44 MST 2007
Author: russell
Date: Tue Feb 27 13:42:43 2007
New Revision: 57006
URL: http://svn.digium.com/view/asterisk?view=rev&rev=57006
Log:
Move the processing of trunk 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=57006&r1=57005&r2=57006
==============================================================================
--- team/russell/sla_updates/apps/app_meetme.c (original)
+++ team/russell/sla_updates/apps/app_meetme.c Tue Feb 27 13:42:43 2007
@@ -3499,17 +3499,15 @@
}
}
-/*! \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 trunk ring timeouts
+ * \note Called with sla.lock locked
+ * \return non-zero if a change to the ringing trunks was made
+ */
+static int sla_calc_trunk_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 */
+ int res = 0;
+
AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_trunks, ringing_trunk, entry) {
int time_left, time_elapsed;
if (!ringing_trunk->trunk->ring_timeout)
@@ -3519,13 +3517,29 @@
if (time_left <= 0) {
AST_LIST_REMOVE_CURRENT(&sla.ringing_trunks, entry);
sla_stop_ringing_trunk(ringing_trunk);
- 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
+
+ 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)
+{
+ 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 */
AST_LIST_TRAVERSE_SAFE_BEGIN(&sla.ringing_stations, ringing_station, entry) {
More information about the asterisk-commits
mailing list