mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 12:37:26 +00:00
core: add 'critical' param on modules.conf to abort on mod load failure from Moc
This commit is contained in:
parent
09a734bb48
commit
2a4d94cc03
@ -1176,13 +1176,20 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init()
|
|||||||
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
|
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
|
||||||
switch_bool_t global = SWITCH_FALSE;
|
switch_bool_t global = SWITCH_FALSE;
|
||||||
const char *val = switch_xml_attr_soft(ld, "module");
|
const char *val = switch_xml_attr_soft(ld, "module");
|
||||||
|
const char *critical = switch_xml_attr_soft(ld, "critical");
|
||||||
const char *sglobal = switch_xml_attr_soft(ld, "global");
|
const char *sglobal = switch_xml_attr_soft(ld, "global");
|
||||||
if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
|
if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
global = switch_true(sglobal);
|
global = switch_true(sglobal);
|
||||||
switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err);
|
|
||||||
|
if (switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) {
|
||||||
|
if (critical && switch_true(critical)) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user