mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
loader: Create ast_module_running_ref.
This function returns NULL if the module in question is not running. I did not change ast_module_ref as most callers do not check the result and they always call ast_module_unref. Make use of this function when running registered items from: * app_stack API's * bridge technologies * CLI commands * File formats * Manager Actions * RTP engines * Sorcery Wizards * Timing Interfaces * Translators * AGI Commands * Fax Technologies ASTERISK-20346 #close Change-Id: Ia16fd28e188b2fc0b9d18b8a5d9cacc31df73fcc
This commit is contained in:
@@ -1161,8 +1161,10 @@ static struct ast_fax_session *fax_session_reserve(struct ast_fax_session_detail
|
||||
if ((faxmod->tech->caps & details->caps) != details->caps) {
|
||||
continue;
|
||||
}
|
||||
if (!ast_module_running_ref(faxmod->tech->module)) {
|
||||
continue;
|
||||
}
|
||||
ast_debug(4, "Reserving a FAX session from '%s'.\n", faxmod->tech->description);
|
||||
ast_module_ref(faxmod->tech->module);
|
||||
s->tech = faxmod->tech;
|
||||
break;
|
||||
}
|
||||
@@ -1279,8 +1281,10 @@ static struct ast_fax_session *fax_session_new(struct ast_fax_session_details *d
|
||||
if ((faxmod->tech->caps & details->caps) != details->caps) {
|
||||
continue;
|
||||
}
|
||||
if (!ast_module_running_ref(faxmod->tech->module)) {
|
||||
continue;
|
||||
}
|
||||
ast_debug(4, "Requesting a new FAX session from '%s'.\n", faxmod->tech->description);
|
||||
ast_module_ref(faxmod->tech->module);
|
||||
if (reserved) {
|
||||
/* Balance module ref from reserved session */
|
||||
ast_module_unref(reserved->tech->module);
|
||||
|
Reference in New Issue
Block a user