aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_h323.c
diff options
context:
space:
mode:
authorqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-13 00:11:09 +0000
committerqwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-12-13 00:11:09 +0000
commit64ef304ee2343cad2b43e0aee1776d4c2f1b80bd (patch)
treec18634611681d34b6996aa6270603e5a304c5ad3 /channels/chan_h323.c
parent38e7d7b10602ea2f90836a1a1cd063a50f3ae40a (diff)
If a typo is found in a config file, we previous continued on with what was already loaded.
We do not want to do this (see bug below for details). This makes it so that if a [ is found without a ], the entire config will fail, and nothing in it will be loaded. Isue #10690. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@92696 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_h323.c')
-rw-r--r--channels/chan_h323.c109
1 files changed, 56 insertions, 53 deletions
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index 2ae04f08d..a6290c8ea 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -2710,6 +2710,56 @@ static struct ast_cli_entry cli_h323[] = {
show_tokens_usage },
};
+static void delete_users(void)
+{
+ int pruned = 0;
+
+ /* Delete all users */
+ ASTOBJ_CONTAINER_WRLOCK(&userl);
+ ASTOBJ_CONTAINER_TRAVERSE(&userl, 1, do {
+ ASTOBJ_RDLOCK(iterator);
+ ASTOBJ_MARK(iterator);
+ ++pruned;
+ ASTOBJ_UNLOCK(iterator);
+ } while (0) );
+ if (pruned) {
+ ASTOBJ_CONTAINER_PRUNE_MARKED(&userl, oh323_destroy_user);
+ }
+ ASTOBJ_CONTAINER_UNLOCK(&userl);
+
+ ASTOBJ_CONTAINER_WRLOCK(&peerl);
+ ASTOBJ_CONTAINER_TRAVERSE(&peerl, 1, do {
+ ASTOBJ_RDLOCK(iterator);
+ ASTOBJ_MARK(iterator);
+ ASTOBJ_UNLOCK(iterator);
+ } while (0) );
+ ASTOBJ_CONTAINER_UNLOCK(&peerl);
+}
+
+static void delete_aliases(void)
+{
+ int pruned = 0;
+
+ /* Delete all aliases */
+ ASTOBJ_CONTAINER_WRLOCK(&aliasl);
+ ASTOBJ_CONTAINER_TRAVERSE(&aliasl, 1, do {
+ ASTOBJ_RDLOCK(iterator);
+ ASTOBJ_MARK(iterator);
+ ++pruned;
+ ASTOBJ_UNLOCK(iterator);
+ } while (0) );
+ if (pruned) {
+ ASTOBJ_CONTAINER_PRUNE_MARKED(&aliasl, oh323_destroy_alias);
+ }
+ ASTOBJ_CONTAINER_UNLOCK(&aliasl);
+}
+
+static void prune_peers(void)
+{
+ /* Prune peers who still are supposed to be deleted */
+ ASTOBJ_CONTAINER_PRUNE_MARKED(&peerl, oh323_destroy_peer);
+}
+
static int reload_config(int is_reload)
{
int format;
@@ -2733,6 +2783,12 @@ static int reload_config(int is_reload)
return 1;
}
+ if (is_reload) {
+ delete_users();
+ delete_aliases();
+ prune_peers();
+ }
+
/* fire up the H.323 Endpoint */
if (!h323_end_point_exist()) {
h323_end_point_create();
@@ -2923,56 +2979,6 @@ static int reload_config(int is_reload)
return 0;
}
-static void delete_users(void)
-{
- int pruned = 0;
-
- /* Delete all users */
- ASTOBJ_CONTAINER_WRLOCK(&userl);
- ASTOBJ_CONTAINER_TRAVERSE(&userl, 1, do {
- ASTOBJ_RDLOCK(iterator);
- ASTOBJ_MARK(iterator);
- ++pruned;
- ASTOBJ_UNLOCK(iterator);
- } while (0) );
- if (pruned) {
- ASTOBJ_CONTAINER_PRUNE_MARKED(&userl, oh323_destroy_user);
- }
- ASTOBJ_CONTAINER_UNLOCK(&userl);
-
- ASTOBJ_CONTAINER_WRLOCK(&peerl);
- ASTOBJ_CONTAINER_TRAVERSE(&peerl, 1, do {
- ASTOBJ_RDLOCK(iterator);
- ASTOBJ_MARK(iterator);
- ASTOBJ_UNLOCK(iterator);
- } while (0) );
- ASTOBJ_CONTAINER_UNLOCK(&peerl);
-}
-
-static void delete_aliases(void)
-{
- int pruned = 0;
-
- /* Delete all aliases */
- ASTOBJ_CONTAINER_WRLOCK(&aliasl);
- ASTOBJ_CONTAINER_TRAVERSE(&aliasl, 1, do {
- ASTOBJ_RDLOCK(iterator);
- ASTOBJ_MARK(iterator);
- ++pruned;
- ASTOBJ_UNLOCK(iterator);
- } while (0) );
- if (pruned) {
- ASTOBJ_CONTAINER_PRUNE_MARKED(&aliasl, oh323_destroy_alias);
- }
- ASTOBJ_CONTAINER_UNLOCK(&aliasl);
-}
-
-static void prune_peers(void)
-{
- /* Prune peers who still are supposed to be deleted */
- ASTOBJ_CONTAINER_PRUNE_MARKED(&peerl, oh323_destroy_peer);
-}
-
static int h323_reload(int fd, int argc, char *argv[])
{
ast_mutex_lock(&h323_reload_lock);
@@ -2988,9 +2994,6 @@ static int h323_reload(int fd, int argc, char *argv[])
static int h323_do_reload(void)
{
- delete_users();
- delete_aliases();
- prune_peers();
reload_config(1);
return 0;
}