[asterisk-commits] mnicholson: branch 1.6.0 r223172 - in /branches/1.6.0: ./ cdr/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 9 12:27:52 CDT 2009


Author: mnicholson
Date: Fri Oct  9 12:27:47 2009
New Revision: 223172

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=223172
Log:
Merged revisions 223136 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r223136 | mnicholson | 2009-10-09 12:14:38 -0500 (Fri, 09 Oct 2009) | 8 lines
  
  Don't close the sqlite database when reloading.  Only close the database when unloading.
  
  (closes issue #15953)
  Reported by: frawd
  Patches:
        sqlite3_rev220097.diff uploaded by frawd (license 610)
  Tested by: frawd
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/cdr/cdr_sqlite3_custom.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/cdr/cdr_sqlite3_custom.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/cdr/cdr_sqlite3_custom.c?view=diff&rev=223172&r1=223171&r2=223172
==============================================================================
--- branches/1.6.0/cdr/cdr_sqlite3_custom.c (original)
+++ branches/1.6.0/cdr/cdr_sqlite3_custom.c Fri Oct  9 12:27:47 2009
@@ -70,7 +70,7 @@
 
 static AST_LIST_HEAD_STATIC(sql_values, values);
 
-static void free_config(void);
+static void free_config(int reload);
 
 static int load_column_config(const char *tmp)
 {
@@ -168,7 +168,7 @@
 		return 0;
 
 	if (reload)
-		free_config();
+		free_config(1);
 
 	if (!(mappingvar = ast_variable_browse(cfg, "master"))) {
 		/* Nothing configured */
@@ -189,7 +189,7 @@
 	tmp = ast_variable_retrieve(cfg, "master", "columns");
 	if (load_column_config(tmp)) {
 		ast_config_destroy(cfg);
-		free_config();
+		free_config(0);
 		return -1;
 	}
 
@@ -197,7 +197,7 @@
 	tmp = ast_variable_retrieve(cfg, "master", "values");
 	if (load_values_config(tmp)) {
 		ast_config_destroy(cfg);
-		free_config();
+		free_config(0);
 		return -1;
 	}
 
@@ -208,11 +208,11 @@
 	return 0;
 }
 
-static void free_config(void)
+static void free_config(int reload)
 {
 	struct values *value;
 
-	if (db) {
+	if (!reload && db) {
 		sqlite3_close(db);
 		db = NULL;
 	}
@@ -287,7 +287,7 @@
 {
 	ast_cdr_unregister(name);
 
-	free_config();
+	free_config(0);
 
 	return 0;
 }
@@ -308,7 +308,7 @@
 	res = sqlite3_open(filename, &db);
 	if (res != SQLITE_OK) {
 		ast_log(LOG_ERROR, "Could not open database %s.\n", filename);
-		free_config();
+		free_config(0);
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -324,7 +324,7 @@
 		if (res != SQLITE_OK) {
 			ast_log(LOG_WARNING, "Unable to create table '%s': %s.\n", table, error);
 			sqlite3_free(error);
-			free_config();
+			free_config(0);
 			return AST_MODULE_LOAD_DECLINE;
 		}
 	}
@@ -332,7 +332,7 @@
 	res = ast_cdr_register(name, desc, sqlite3_log);
 	if (res) {
 		ast_log(LOG_ERROR, "Unable to register custom SQLite3 CDR handling\n");
-		free_config();
+		free_config(0);
 		return AST_MODULE_LOAD_DECLINE;
 	}
 




More information about the asterisk-commits mailing list