[asterisk-commits] jpeeler: branch jpeeler/feature14882 r286903 - /team/jpeeler/feature14882/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 15 12:16:45 CDT 2010


Author: jpeeler
Date: Wed Sep 15 12:16:41 2010
New Revision: 286903

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=286903
Log:
changed parking lots to only be removed on reload only after lots have been created from the config

Modified:
    team/jpeeler/feature14882/main/features.c

Modified: team/jpeeler/feature14882/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jpeeler/feature14882/main/features.c?view=diff&rev=286903&r1=286902&r2=286903
==============================================================================
--- team/jpeeler/feature14882/main/features.c (original)
+++ team/jpeeler/feature14882/main/features.c Wed Sep 15 12:16:41 2010
@@ -359,6 +359,7 @@
 	int parkedcallreparking;                        /*!< Enable DTMF based parking on bridge when picking up parked calls */
 	int parkedcallhangup;                           /*!< Enable DTMF based hangup on a bridge when pickup up parked calls */
 	int parkedcallrecording;                        /*!< Enable DTMF based recording on a bridge when picking up parked calls */
+	unsigned short the_mark:1;                      /*!< Used during reloads, that which bears the_mark shall be deleted! */
 	AST_LIST_HEAD(parkinglot_parklist, parkeduser) parkings; /*!< List of active parkings in this parkinglot */
 };
 
@@ -4261,8 +4262,6 @@
 	con = ast_context_find(ruin->parking_con);
 	if (con)
 		ast_context_destroy(con, registrar);
-	ao2_unlink(parkinglots, ruin);
-	ao2_ref(ruin, -1);
 }
 
 /*! 
@@ -4413,9 +4412,11 @@
 	if (error) {
 		ast_log(LOG_WARNING, "Parking %s not open for business. Configuration error.\n", name);
 		parkinglot_destroy(parkinglot);
+		parkinglot_unref(parkinglot);
 		return NULL;
 	}
 	ast_debug(1, "Parking %s now open for business. (start exten %d end %d)\n", name, start, end);
+	parkinglot->the_mark = 0;
 
 	/* Move it into the list, if it wasn't already there */
 	if (!oldparkinglot) {
@@ -4425,7 +4426,6 @@
 
 	return parkinglot;
 }
-
 
 static int load_config(void) 
 {
@@ -4446,15 +4446,6 @@
 		"featuremap",
 		"applicationmap"
 	};
-	struct ao2_iterator iter;
-	struct ast_parkinglot *curlot;
-
-	/* delete existing parkinglots */
-	iter = ao2_iterator_init(parkinglots, 0);
-	while ((curlot = ao2_iterator_next(&iter))) {
-		parkinglot_destroy(curlot);
-	}
-	ao2_iterator_destroy(&iter);
 
 	default_parkinglot = build_parkinglot(DEFAULT_PARKINGLOT, NULL);
 	if (default_parkinglot) {
@@ -4861,12 +4852,26 @@
 	return CLI_SUCCESS;
 }
 
+static int parkinglot_markall_cb(void *obj, void *arg, int flags)
+{
+	struct ast_parkinglot *parkinglot = obj;
+	parkinglot->the_mark = 1;
+	return 0;
+}
+
+static int parkinglot_is_marked_cb(void *obj, void *arg, int flags)
+{
+	struct ast_parkinglot *parkinglot = obj;
+	return parkinglot->the_mark ? CMP_MATCH : 0;
+}
+
 int ast_features_reload(void)
 {
 	int res;
 
-	/* Reload configuration */
-	res = load_config();
+	ao2_t_callback(parkinglots, OBJ_NODATA, parkinglot_markall_cb, NULL, "callback to mark all parkinglots");
+	res = load_config(); /* Reload configuration */
+	ao2_t_callback(parkinglots, OBJ_NODATA | OBJ_UNLINK, parkinglot_is_marked_cb, NULL, "callback to remove all marked parkinglots");
 	
 	return res;
 }




More information about the asterisk-commits mailing list