[asterisk-commits] russell: branch 1.8 r281052 - in /branches/1.8: ./ main/cdr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 5 08:16:14 CDT 2010


Author: russell
Date: Thu Aug  5 08:16:11 2010
New Revision: 281052

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281052
Log:
Merged revisions 281051 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
  r281051 | russell | 2010-08-05 08:11:32 -0500 (Thu, 05 Aug 2010) | 9 lines
  
  Cleanup deafult option value handling for cdr.conf [general].
  
  The default values would differ depending on whether or not cdr.conf exists.
  That is no longer the case.
  
  Apply a default value to the unanswered option.
  
  Define all default values as named constants.
........

Modified:
    branches/1.8/   (props changed)
    branches/1.8/main/cdr.c

Propchange: branches/1.8/
------------------------------------------------------------------------------
--- branch-1.6.2-merged (original)
+++ branch-1.6.2-merged Thu Aug  5 08:16:11 2010
@@ -1,1 +1,1 @@
-/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449,280551,280671,280739,280983
+/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449,280551,280671,280739,280983,281051

Modified: branches/1.8/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/cdr.c?view=diff&rev=281052&r1=281051&r2=281052
==============================================================================
--- branches/1.8/main/cdr.c (original)
+++ branches/1.8/main/cdr.c Thu Aug  5 08:16:11 2010
@@ -84,18 +84,26 @@
 static int cdr_sched = -1;
 static pthread_t cdr_thread = AST_PTHREADT_NULL;
 
-#define BATCH_SIZE_DEFAULT 100
-#define BATCH_TIME_DEFAULT 300
-#define BATCH_SCHEDULER_ONLY_DEFAULT 0
-#define BATCH_SAFE_SHUTDOWN_DEFAULT 1
-
-static int enabled;		/*! Is the CDR subsystem enabled ? */
+static int enabled;
+static const int ENABLED_DEFAULT = 1;
+
+static int batchmode;
+static const int BATCHMODE_DEFAULT = 0;
+
 static int unanswered;
-static int batchmode;
+static const int UNANSWERED_DEFAULT = 0;
+
 static int batchsize;
+static const int BATCH_SIZE_DEFAULT = 100;
+
 static int batchtime;
+static const int BATCH_TIME_DEFAULT = 300;
+
 static int batchscheduleronly;
+static const int BATCH_SCHEDULER_ONLY_DEFAULT = 0;
+
 static int batchsafeshutdown;
+static const int BATCH_SAFE_SHUTDOWN_DEFAULT = 1;
 
 AST_MUTEX_DEFINE_STATIC(cdr_batch_lock);
 
@@ -1492,22 +1500,27 @@
 	int res=0;
 	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
 
-	if ((config = ast_config_load2("cdr.conf", "cdr", config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+	if ((config = ast_config_load2("cdr.conf", "cdr", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
 		return 0;
-	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEUNCHANGED || config == CONFIG_STATUS_FILEINVALID) {
-		return 0;
 	}
 
 	ast_mutex_lock(&cdr_batch_lock);
+
+	was_enabled = enabled;
+	was_batchmode = batchmode;
 
 	batchsize = BATCH_SIZE_DEFAULT;
 	batchtime = BATCH_TIME_DEFAULT;
 	batchscheduleronly = BATCH_SCHEDULER_ONLY_DEFAULT;
 	batchsafeshutdown = BATCH_SAFE_SHUTDOWN_DEFAULT;
-	was_enabled = enabled;
-	was_batchmode = batchmode;
-	enabled = 1;
-	batchmode = 0;
+	enabled = ENABLED_DEFAULT;
+	batchmode = BATCHMODE_DEFAULT;
+	unanswered = UNANSWERED_DEFAULT;
+
+	if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEINVALID) {
+		ast_mutex_unlock(&cdr_batch_lock);
+		return 0;
+	}
 
 	/* don't run the next scheduled CDR posting while reloading */
 	AST_SCHED_DEL(sched, cdr_sched);




More information about the asterisk-commits mailing list