diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-14 21:10:00 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-04-14 21:10:00 +0000 |
commit | 792e23454ac673a1252bca288bf165fc3a974d9d (patch) | |
tree | 6e355bc7694f7bc3942bd8b00d1e20513666fbc8 | |
parent | 5942a633ad2b44d811e8972eb85c3873e9217a13 (diff) |
Store modules in the order they're loaded to make reload work properly
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2691 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | loader.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -305,9 +305,22 @@ int ast_load_resource(char *resource_name) if (option_verbose) ast_verbose(VERBOSE_PREFIX_1 "Loaded %s => (%s)\n", fn, m->description()); } - m->next = module_list; + + // add module 'm' to end of module_list chain + // so reload commands will be issued in same order modules were loaded + m->next = NULL; + if (module_list == NULL) { + // empty list so far, add at front + module_list = m; + } + else { + struct module *i; + // find end of chain, and add there + for (i = module_list; i->next; i = i->next) + ; + i->next = m; + } - module_list = m; ast_mutex_unlock(&modlock); if ((res = m->load_module())) { ast_log(LOG_WARNING, "%s: load_module failed, returning %d\n", m->resource, res); |