[svn-commits] seanbright: branch seanbright/cdr-syslog r203844 - /team/seanbright/cdr-syslo...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jun 26 16:55:33 CDT 2009
Author: seanbright
Date: Fri Jun 26 16:55:30 2009
New Revision: 203844
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203844
Log:
Make cdr_syslog reload slightly more elegant.
Modified:
team/seanbright/cdr-syslog/cdr/cdr_syslog.c
Modified: team/seanbright/cdr-syslog/cdr/cdr_syslog.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/seanbright/cdr-syslog/cdr/cdr_syslog.c?view=diff&rev=203844&r1=203843&r2=203844
==============================================================================
--- team/seanbright/cdr-syslog/cdr/cdr_syslog.c (original)
+++ team/seanbright/cdr-syslog/cdr/cdr_syslog.c Fri Jun 26 16:55:30 2009
@@ -119,19 +119,25 @@
return 0;
}
-static int load_config(void)
+static int load_config(int reload)
{
struct ast_config *cfg;
- struct ast_flags config_flags = { 0 };
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
int default_facility = LOG_LOCAL4;
int default_priority = LOG_INFO;
const char *catg = NULL, *tmp;
cfg = ast_config_load(CONFIG, config_flags);
- if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
+ if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
ast_log(AST_LOG_ERROR,
"Unable to load %s. Not logging custom CSV CDRs to syslog.\n", CONFIG);
return -1;
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
+ return 0;
+ }
+
+ if (reload) {
+ free_config();
}
if (!(ast_strlen_zero(tmp = ast_variable_retrieve(cfg, "general", "facility")))) {
@@ -240,7 +246,7 @@
return AST_MODULE_LOAD_DECLINE;
}
- res = load_config();
+ res = load_config(0);
AST_RWLIST_UNLOCK(&sinks);
if (res) {
return AST_MODULE_LOAD_DECLINE;
@@ -258,7 +264,7 @@
}
free_config();
- res = load_config();
+ res = load_config(1);
AST_RWLIST_UNLOCK(&sinks);
return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;
More information about the svn-commits
mailing list