[asterisk-commits] tilghman: trunk r79940 - /trunk/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Aug 18 08:52:45 CDT 2007
Author: tilghman
Date: Sat Aug 18 08:52:44 2007
New Revision: 79940
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79940
Log:
We weren't properly encapsulating the mtime ignores of config files (closes issue #10488)
Modified:
trunk/channels/chan_h323.c
trunk/channels/chan_iax2.c
trunk/channels/chan_sip.c
trunk/channels/chan_zap.c
Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_h323.c?view=diff&rev=79940&r1=79939&r2=79940
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Sat Aug 18 08:52:44 2007
@@ -2831,6 +2831,12 @@
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_do_reload(void)
{
- delete_users();
- delete_aliases();
- prune_peers();
reload_config(1);
return 0;
}
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=79940&r1=79939&r2=79940
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sat Aug 18 08:52:44 2007
@@ -9898,6 +9898,22 @@
#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,13 +9944,17 @@
} 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);
} else { /* iax.conf changed, gotta reread users.conf, too */
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
ucfg = ast_config_load("users.conf", config_flags);
+ }
+
+ if (reload) {
+ set_config_destroy();
}
/* Reset global codec prefs */
@@ -10295,35 +10315,23 @@
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;
-
- 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);
+ 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);
+
+ /* 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);
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=79940&r1=79939&r2=79940
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Aug 18 08:52:44 2007
@@ -17626,7 +17626,7 @@
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 @@
} 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 @@
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 @@
/*! \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 */
Modified: trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_zap.c?view=diff&rev=79940&r1=79939&r2=79940
==============================================================================
--- trunk/channels/chan_zap.c (original)
+++ trunk/channels/chan_zap.c Sat Aug 18 08:52:44 2007
@@ -10712,7 +10712,7 @@
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 @@
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
More information about the asterisk-commits
mailing list