提交 24bcd105 authored 作者: Mathieu Rene's avatar Mathieu Rene

don't hold loadable_modules.mutex while a module shutdown function is run, so…

don't hold loadable_modules.mutex while a module shutdown function is run, so that we do not prevent new channels from being created.
上级 4eb5bbf4
......@@ -1047,20 +1047,24 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Module is not unloadable.\n");
*err = "Module is not unloadable";
status = SWITCH_STATUS_NOUNLOAD;
goto end;
goto unlock;
} else {
if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err) != SWITCH_STATUS_SUCCESS)) {
goto end;
/* Prevent anything from using the module while it's shutting down */
switch_core_hash_delete(loadable_modules.module_hash, fname);
switch_mutex_unlock(loadable_modules.mutex);
if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err)) != SWITCH_STATUS_SUCCESS) {
/* Something went wrong in the module's shutdown function, add it again */
switch_core_hash_insert_locked(loadable_modules.module_hash, fname, module, loadable_modules.mutex);
}
goto end;
}
switch_core_hash_delete(loadable_modules.module_hash, fname);
} else {
*err = "No such module!";
status = SWITCH_STATUS_FALSE;
}
end:
unlock:
switch_mutex_unlock(loadable_modules.mutex);
end:
if (force) {
switch_yield(1000000);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PHEW!\n");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论