mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 18:46:16 +00:00
Don't reload a configuration file if nothing has changed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -261,27 +261,28 @@ static struct ast_translator lintolpc10 = {
|
||||
.buf_size = LPC10_BYTES_IN_COMPRESSED_FRAME * (1 + BUFFER_SAMPLES / LPC10_SAMPLES_PER_FRAME),
|
||||
};
|
||||
|
||||
static void parse_config(void)
|
||||
static void parse_config(int reload)
|
||||
{
|
||||
struct ast_variable *var;
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf");
|
||||
if (!cfg)
|
||||
struct ast_variable *var;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
|
||||
if (cfg == NULL || cfg == CONFIG_STATUS_FILEUNCHANGED)
|
||||
return;
|
||||
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
if (!strcasecmp(var->name, "genericplc")) {
|
||||
lpc10tolin.useplc = ast_true(var->value) ? 1 : 0;
|
||||
ast_verb(3, "codec_lpc10: %susing generic PLC\n",
|
||||
lpc10tolin.useplc ? "" : "not ");
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_config_destroy(cfg);
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
parse_config();
|
||||
parse_config(1);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -299,10 +300,10 @@ static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
parse_config();
|
||||
res=ast_register_translator(&lpc10tolin);
|
||||
parse_config(0);
|
||||
res = ast_register_translator(&lpc10tolin);
|
||||
if (!res)
|
||||
res=ast_register_translator(&lintolpc10);
|
||||
res = ast_register_translator(&lintolpc10);
|
||||
else
|
||||
ast_unregister_translator(&lpc10tolin);
|
||||
|
||||
|
Reference in New Issue
Block a user