diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-05 18:56:12 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-01-05 18:56:12 +0000 |
commit | 7db1a257be95783cd2c6ff9223c65ba003efffc4 (patch) | |
tree | c5e3d5967f55f3ccf1070ba8e11228dbf820a1ff | |
parent | 0794e20431a8759cf7d93d1785cbe284b97921b8 (diff) |
Merged revisions 300622 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r300622 | tilghman | 2011-01-05 12:54:58 -0600 (Wed, 05 Jan 2011) | 17 lines
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
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@300623 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | res/res_odbc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c index 6e179efff..67ba3111d 100644 --- a/res/res_odbc.c +++ b/res/res_odbc.c @@ -596,12 +596,11 @@ SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struc } 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; } } @@ -643,7 +642,7 @@ SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_c 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; @@ -652,7 +651,9 @@ SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_c * 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 { |