[svn-commits] tilghman: branch 1.4 r300621 - /branches/1.4/res/res_odbc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 5 18:47:51 UTC 2011


Author: tilghman
Date: Wed Jan  5 12:47:46 2011
New Revision: 300621

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=300621
Log:
Use the sanity check in place of the disconnect/connect cycle.

The disconnect/connect cycle has the potential to cause random crashes.

(closes issue #18243)
 Reported by: ks3
 Patches: 
       res_odbc.patch uploaded by ks3 (license 1147)
 Tested by: ks3

Modified:
    branches/1.4/res/res_odbc.c

Modified: branches/1.4/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/res/res_odbc.c?view=diff&rev=300621&r1=300620&r2=300621
==============================================================================
--- branches/1.4/res/res_odbc.c (original)
+++ branches/1.4/res/res_odbc.c Wed Jan  5 12:47:46 2011
@@ -110,26 +110,20 @@
 					}
 				}
 
-				ast_log(LOG_WARNING, "SQL Execute error %d! Attempting a reconnect...\n", res);
+				ast_log(LOG_WARNING, "SQL Execute error %d! Verifying connection to %s [%s]...\n", res, obj->parent->name, obj->parent->dsn);
 				SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 				stmt = NULL;
 
-				obj->up = 0;
-				/*
-				 * While this isn't the best way to try to correct an error, this won't automatically
-				 * fail when the statement handle invalidates.
-				 */
-				/* XXX Actually, it might, if we're using a non-pooled connection. Possible race here. XXX */
-				odbc_obj_disconnect(obj);
-				odbc_obj_connect(obj);
+				if (!ast_odbc_sanity_check(obj)) {
+					break;
+				}
 				continue;
 			} else
 				obj->last_used = ast_tvnow();
 			break;
 		} else {
-			ast_log(LOG_WARNING, "SQL Prepare failed.  Attempting a reconnect...\n");
-			odbc_obj_disconnect(obj);
-			odbc_obj_connect(obj);
+			ast_log(LOG_WARNING, "SQL Prepare failed.  Verifying connection to %s [%s]\n", obj->parent->name, obj->parent->dsn);
+			ast_odbc_sanity_check(obj);
 		}
 	}
 




More information about the svn-commits mailing list