[asterisk-addons-commits] tilghman: branch 1.4 r981 - /branches/1.4/res/res_config_mysql.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Mon Jul 6 16:30:19 CDT 2009


Author: tilghman
Date: Mon Jul  6 16:30:13 2009
New Revision: 981

URL: http://svn.asterisk.org/svn-view/asterisk-addons?view=rev&rev=981
Log:
Don't reset reconnect time, unless a reconnect really occurred.
(closes issue #15375)
 Reported by: kowalma
 Patches: 
       20090628__issue15375.diff.txt uploaded by tilghman (license 14)
 Tested by: kowalma, jacco

Modified:
    branches/1.4/res/res_config_mysql.c

Modified: branches/1.4/res/res_config_mysql.c
URL: http://svn.asterisk.org/svn-view/asterisk-addons/branches/1.4/res/res_config_mysql.c?view=diff&rev=981&r1=980&r2=981
==============================================================================
--- branches/1.4/res/res_config_mysql.c (original)
+++ branches/1.4/res/res_config_mysql.c Mon Jul  6 16:30:13 2009
@@ -629,6 +629,7 @@
 			ast_log(LOG_ERROR, "MySQL RealTime: Failed to connect database server %s on %s (err %d). Check debug for more info.\n", dbname, dbhost, mysql_errno(&mysql));
 			ast_log(LOG_DEBUG, "MySQL RealTime: Cannot Connect (%d): %s\n", mysql_errno(&mysql), mysql_error(&mysql));
 			connected = 0;
+			connect_time = 0;
 			return 0;
 		}
 	} else {
@@ -636,13 +637,16 @@
 		 * So the postman pings twice. */
 		if (mysql_ping(&mysql) != 0 && mysql_ping(&mysql) != 0) {
 			connected = 0;
+			connect_time = 0;
 			ast_log(LOG_ERROR, "MySQL RealTime: Ping failed (%d).  Trying an explicit reconnect.\n", mysql_errno(&mysql));
 			ast_log(LOG_DEBUG, "MySQL RealTime: Server Error (%d): %s\n", mysql_errno(&mysql), mysql_error(&mysql));
 			goto reconnect_tryagain;
 		}
 
-		connected = 1;
-		connect_time = time(NULL);
+		if (!connected) {
+			connected = 1;
+			connect_time = time(NULL);
+		}
 
 		if(mysql_select_db(&mysql, my_database) != 0) {
 			ast_log(LOG_WARNING, "MySQL RealTime: Unable to select database: %s. Still Connected (%u).\n", my_database, mysql_errno(&mysql));




More information about the asterisk-addons-commits mailing list