[asterisk-commits] russell: branch russell/sla_reload r70653 - /team/russell/sla_reload/apps/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 21 00:33:53 CDT 2007


Author: russell
Date: Thu Jun 21 00:33:52 2007
New Revision: 70653

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70653
Log:
add some initial pieces that queue up a reload event to be handled by the sla thread

Modified:
    team/russell/sla_reload/apps/app_meetme.c

Modified: team/russell/sla_reload/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/sla_reload/apps/app_meetme.c?view=diff&rev=70653&r1=70652&r2=70653
==============================================================================
--- team/russell/sla_reload/apps/app_meetme.c (original)
+++ team/russell/sla_reload/apps/app_meetme.c Thu Jun 21 00:33:52 2007
@@ -483,6 +483,8 @@
 	SLA_EVENT_DIAL_STATE,
 	/*! The state of a ringing trunk has changed */
 	SLA_EVENT_RINGING_TRUNK,
+	/*! A reload of configuration has been requested */
+	SLA_EVENT_RELOAD,
 };
 
 struct sla_event {
@@ -538,6 +540,8 @@
 	/*! Attempt to handle CallerID, even though it is known not to work
 	 *  properly in some situations. */
 	unsigned int attempt_callerid:1;
+	/*! A reload has been requested */
+	unsigned int reload:1;
 } sla = {
 	.thread = AST_PTHREADT_NULL,
 };
@@ -3999,6 +4003,12 @@
 	return 1;
 }
 
+/*! \brief Check if we can do a reload of SLA, and do it if we can */
+static void sla_check_reload(void)
+{
+
+}
+
 static void *sla_thread(void *data)
 {
 	struct sla_failed_station *failed_station;
@@ -4035,10 +4045,16 @@
 			case SLA_EVENT_RINGING_TRUNK:
 				sla_handle_ringing_trunk_event();
 				break;
+			case SLA_EVENT_RELOAD:
+				sla.reload = 1;
+				break;
 			}
 			ast_free(event);
 			ast_mutex_lock(&sla.lock);
 		}
+
+		if (sla.reload)
+			sla_check_reload();
 	}
 
 	ast_mutex_unlock(&sla.lock);
@@ -4835,13 +4851,16 @@
 
 static int load_config(int reload)
 {
-	int res = 0;
-
 	load_config_meetme();
-	if (!reload)
-		res = sla_load_config();
-
-	return res;
+
+	if (reload) {
+		sla_queue_event(SLA_EVENT_RELOAD);
+		ast_log(LOG_NOTICE, "A reload of the SLA configuration has been requested "
+			"and will be completed when the system is idle.\n");
+		return 0;
+	}
+	
+	return sla_load_config();
 }
 
 static int unload_module(void)




More information about the asterisk-commits mailing list