[asterisk-commits] tilghman: branch 1.6.2 r300622 - in /branches/1.6.2: ./ res/res_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 5 18:55:03 UTC 2011


Author: tilghman
Date: Wed Jan  5 12:54:58 2011
New Revision: 300622

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

........
  r300621 | tilghman | 2011-01-05 12:47:46 -0600 (Wed, 05 Jan 2011) | 10 lines
  
  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.6.2/   (props changed)
    branches/1.6.2/res/res_odbc.c

Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: branches/1.6.2/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/res/res_odbc.c?view=diff&rev=300622&r1=300621&r2=300622
==============================================================================
--- branches/1.6.2/res/res_odbc.c (original)
+++ branches/1.6.2/res/res_odbc.c Wed Jan  5 12:54:58 2011
@@ -578,12 +578,11 @@
 		} else if (obj->tx) {
 			ast_log(LOG_WARNING, "Failed to execute, but unable to reconnect, as we're transactional.\n");
 			break;
-		} else {
-			obj->up = 0;
-			ast_log(LOG_WARNING, "SQL Exec Direct failed.  Attempting a reconnect...\n");
-
-			odbc_obj_disconnect(obj);
-			odbc_obj_connect(obj);
+		} else if (attempt == 0) {
+			ast_log(LOG_WARNING, "SQL Execute error! Verifying connection to %s [%s]...\n", obj->parent->name, obj->parent->dsn);
+		}
+		if (!ast_odbc_sanity_check(obj)) {
+			break;
 		}
 	}
 
@@ -625,7 +624,7 @@
 					ast_log(LOG_WARNING, "SQL Execute error, but unable to reconnect, as we're transactional.\n");
 					break;
 				} else {
-					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;
 
@@ -634,7 +633,9 @@
 					 * While this isn't the best way to try to correct an error, this won't automatically
 					 * fail when the statement handle invalidates.
 					 */
-					ast_odbc_sanity_check(obj);
+					if (!ast_odbc_sanity_check(obj)) {
+						break;
+					}
 					continue;
 				}
 			} else {




More information about the asterisk-commits mailing list