We weren't properly encapsulating the mtime ignores of config files (closes issue #10488)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79940 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
1de27672ee
commit
9d218d354a
|
@ -2831,6 +2831,12 @@ static int reload_config(int is_reload)
|
|||
ucfg = ast_config_load("users.conf", config_flags);
|
||||
}
|
||||
|
||||
if (is_reload) {
|
||||
delete_users();
|
||||
delete_aliases();
|
||||
prune_peers();
|
||||
}
|
||||
|
||||
/* fire up the H.323 Endpoint */
|
||||
if (!h323_end_point_exist()) {
|
||||
h323_end_point_create();
|
||||
|
@ -3085,9 +3091,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;
|
||||
}
|
||||
|
|
|
@ -9898,6 +9898,22 @@ static void set_timing(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void set_config_destroy(void)
|
||||
{
|
||||
strcpy(accountcode, "");
|
||||
strcpy(language, "");
|
||||
strcpy(mohinterpret, "default");
|
||||
strcpy(mohsuggest, "");
|
||||
global_max_trunk_mtu = MAX_TRUNK_MTU;
|
||||
trunkmaxsize = MAX_TRUNKDATA;
|
||||
amaflags = 0;
|
||||
delayreject = 0;
|
||||
ast_clear_flag((&globalflags), IAX_NOTRANSFER);
|
||||
ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
|
||||
ast_clear_flag((&globalflags), IAX_USEJITTERBUF);
|
||||
ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);
|
||||
delete_users();
|
||||
}
|
||||
|
||||
/*! \brief Load configuration */
|
||||
static int set_config(char *config_file, int reload)
|
||||
|
@ -9928,7 +9944,7 @@ static int set_config(char *config_file, int reload)
|
|||
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
|
||||
ucfg = ast_config_load("users.conf", config_flags);
|
||||
if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
|
||||
return 0;
|
||||
return 1;
|
||||
/* Otherwise we need to reread both files */
|
||||
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
|
||||
cfg = ast_config_load(config_file, config_flags);
|
||||
|
@ -9937,6 +9953,10 @@ static int set_config(char *config_file, int reload)
|
|||
ucfg = ast_config_load("users.conf", config_flags);
|
||||
}
|
||||
|
||||
if (reload) {
|
||||
set_config_destroy();
|
||||
}
|
||||
|
||||
/* Reset global codec prefs */
|
||||
memset(&prefs, 0 , sizeof(struct ast_codec_pref));
|
||||
|
||||
|
@ -10295,35 +10315,23 @@ static int reload_config(void)
|
|||
struct iax2_registry *reg;
|
||||
struct iax2_peer *peer;
|
||||
|
||||
strcpy(accountcode, "");
|
||||
strcpy(language, "");
|
||||
strcpy(mohinterpret, "default");
|
||||
strcpy(mohsuggest, "");
|
||||
global_max_trunk_mtu = MAX_TRUNK_MTU;
|
||||
trunkmaxsize = MAX_TRUNKDATA;
|
||||
amaflags = 0;
|
||||
delayreject = 0;
|
||||
ast_clear_flag((&globalflags), IAX_NOTRANSFER);
|
||||
ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
|
||||
ast_clear_flag((&globalflags), IAX_USEJITTERBUF);
|
||||
ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);
|
||||
delete_users();
|
||||
set_config(config, 1);
|
||||
prune_peers();
|
||||
prune_users();
|
||||
trunk_timed = trunk_untimed = 0;
|
||||
trunk_nmaxmtu = trunk_maxmtu = 0;
|
||||
if (set_config(config, 1) == 1) {
|
||||
prune_peers();
|
||||
prune_users();
|
||||
trunk_timed = trunk_untimed = 0;
|
||||
trunk_nmaxmtu = trunk_maxmtu = 0;
|
||||
|
||||
AST_LIST_LOCK(®istrations);
|
||||
AST_LIST_TRAVERSE(®istrations, reg, entry)
|
||||
iax2_do_register(reg);
|
||||
AST_LIST_UNLOCK(®istrations);
|
||||
AST_LIST_LOCK(®istrations);
|
||||
AST_LIST_TRAVERSE(®istrations, reg, entry)
|
||||
iax2_do_register(reg);
|
||||
AST_LIST_UNLOCK(®istrations);
|
||||
|
||||
/* Qualify hosts, too */
|
||||
AST_LIST_LOCK(&peers);
|
||||
AST_LIST_TRAVERSE(&peers, peer, entry)
|
||||
iax2_poke_peer(peer, 0);
|
||||
AST_LIST_UNLOCK(&peers);
|
||||
/* Qualify hosts, too */
|
||||
AST_LIST_LOCK(&peers);
|
||||
AST_LIST_TRAVERSE(&peers, peer, entry)
|
||||
iax2_poke_peer(peer, 0);
|
||||
AST_LIST_UNLOCK(&peers);
|
||||
}
|
||||
reload_firmware();
|
||||
iax_provision_reload(1);
|
||||
|
||||
|
|
|
@ -17626,7 +17626,7 @@ static int reload_config(enum channelreloadreason reason)
|
|||
char *cat, *stringp, *context, *oldregcontext;
|
||||
char newcontexts[AST_MAX_CONTEXT], oldcontexts[AST_MAX_CONTEXT];
|
||||
struct ast_flags dummy[2];
|
||||
struct ast_flags config_flags = { CONFIG_FLAG_FILEUNCHANGED };
|
||||
struct ast_flags config_flags = { reason == CHANNEL_MODULE_LOAD ? 0 : CONFIG_FLAG_FILEUNCHANGED };
|
||||
int auto_sip_domains = FALSE;
|
||||
struct sockaddr_in old_bindaddr = bindaddr;
|
||||
int registry_count = 0, peer_count = 0, user_count = 0;
|
||||
|
@ -17640,7 +17640,7 @@ static int reload_config(enum channelreloadreason reason)
|
|||
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
|
||||
ucfg = ast_config_load("users.conf", config_flags);
|
||||
if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
|
||||
return 0;
|
||||
return 1;
|
||||
/* Must reread both files, because one changed */
|
||||
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
|
||||
cfg = ast_config_load(config, config_flags);
|
||||
|
@ -17648,7 +17648,35 @@ static int reload_config(enum channelreloadreason reason)
|
|||
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
|
||||
ucfg = ast_config_load("users.conf", config_flags);
|
||||
}
|
||||
|
||||
|
||||
if (reason != CHANNEL_MODULE_LOAD) {
|
||||
ast_debug(4, "--------------- SIP reload started\n");
|
||||
|
||||
clear_realm_authentication(authl);
|
||||
clear_sip_domains();
|
||||
authl = NULL;
|
||||
|
||||
/* First, destroy all outstanding registry calls */
|
||||
/* This is needed, since otherwise active registry entries will not be destroyed */
|
||||
ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do {
|
||||
ASTOBJ_RDLOCK(iterator);
|
||||
if (iterator->call) {
|
||||
ast_debug(3, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
|
||||
/* This will also remove references to the registry */
|
||||
iterator->call = sip_destroy(iterator->call);
|
||||
}
|
||||
ASTOBJ_UNLOCK(iterator);
|
||||
|
||||
} while(0));
|
||||
|
||||
/* Then, actually destroy users and registry */
|
||||
ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
|
||||
ast_debug(4, "--------------- Done destroying user list\n");
|
||||
ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy);
|
||||
ast_debug(4, "--------------- Done destroying registry list\n");
|
||||
ASTOBJ_CONTAINER_MARKALL(&peerl);
|
||||
}
|
||||
|
||||
/* Initialize copy of current global_regcontext for later use in removing stale contexts */
|
||||
ast_copy_string(oldcontexts, global_regcontext, sizeof(oldcontexts));
|
||||
oldregcontext = oldcontexts;
|
||||
|
@ -18690,31 +18718,6 @@ static void sip_send_all_registers(void)
|
|||
/*! \brief Reload module */
|
||||
static int sip_do_reload(enum channelreloadreason reason)
|
||||
{
|
||||
ast_debug(4, "--------------- SIP reload started\n");
|
||||
|
||||
clear_realm_authentication(authl);
|
||||
clear_sip_domains();
|
||||
authl = NULL;
|
||||
|
||||
/* First, destroy all outstanding registry calls */
|
||||
/* This is needed, since otherwise active registry entries will not be destroyed */
|
||||
ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do {
|
||||
ASTOBJ_RDLOCK(iterator);
|
||||
if (iterator->call) {
|
||||
ast_debug(3, "Destroying active SIP dialog for registry %s@%s\n", iterator->username, iterator->hostname);
|
||||
/* This will also remove references to the registry */
|
||||
iterator->call = sip_destroy(iterator->call);
|
||||
}
|
||||
ASTOBJ_UNLOCK(iterator);
|
||||
|
||||
} while(0));
|
||||
|
||||
/* Then, actually destroy users and registry */
|
||||
ASTOBJ_CONTAINER_DESTROYALL(&userl, sip_destroy_user);
|
||||
ast_debug(4, "--------------- Done destroying user list\n");
|
||||
ASTOBJ_CONTAINER_DESTROYALL(®l, sip_registry_destroy);
|
||||
ast_debug(4, "--------------- Done destroying registry list\n");
|
||||
ASTOBJ_CONTAINER_MARKALL(&peerl);
|
||||
reload_config(reason);
|
||||
|
||||
/* Prune peers who still are supposed to be deleted */
|
||||
|
|
|
@ -10712,7 +10712,7 @@ static int zap_restart(void)
|
|||
destroy_channel(NULL, iflist, 1);
|
||||
}
|
||||
ast_debug(1, "Channels destroyed. Now re-reading config.\n");
|
||||
if (setup_zap(1) != 0) {
|
||||
if (setup_zap(2) != 0) {
|
||||
ast_log(LOG_WARNING, "Reload channels from zap config failed!\n");
|
||||
return 1;
|
||||
}
|
||||
|
@ -12629,7 +12629,7 @@ static int setup_zap(int reload)
|
|||
struct ast_variable *v;
|
||||
struct zt_chan_conf base_conf = zt_chan_conf_default();
|
||||
struct zt_chan_conf conf;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_flags config_flags = { reload == 1 ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
int res;
|
||||
|
||||
#ifdef HAVE_PRI
|
||||
|
|
Reference in New Issue