aboutsummaryrefslogtreecommitdiffstats
path: root/addons
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-06 21:37:39 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-07-06 21:37:39 +0000
commit791eff24f881622d3f002cda5b006f4bdd745717 (patch)
tree9984b9134da2912276ef9b31894f80d2fd0fca28 /addons
parentdb49d9fa2374c035d7b7fdc14281acbaedee3ab4 (diff)
Merged revisions 981 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/branches/1.4 ........ r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines 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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@204986 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'addons')
-rw-r--r--addons/res_config_mysql.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index 76a741695..462f45aaa 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -1563,6 +1563,7 @@ reconnect_tryagain:
ast_log(LOG_ERROR, "MySQL RealTime: Failed to connect database server %s on %s (err %d). Check debug for more info.\n", conn->name, !ast_strlen_zero(conn->host) ? conn->host : conn->sock, mysql_errno(&conn->handle));
ast_debug(1, "MySQL RealTime: Cannot Connect (%d): %s\n", mysql_errno(&conn->handle), mysql_error(&conn->handle));
conn->connected = 0;
+ conn->connect_time = 0;
return 0;
}
} else {
@@ -1570,13 +1571,16 @@ reconnect_tryagain:
* So the postman pings twice. */
if (mysql_ping(&conn->handle) != 0 && (usleep(1) + 2 > 0) && mysql_ping(&conn->handle) != 0) {
conn->connected = 0;
+ conn->connect_time = 0;
ast_log(LOG_ERROR, "MySQL RealTime: Ping failed (%d). Trying an explicit reconnect.\n", mysql_errno(&conn->handle));
ast_debug(1, "MySQL RealTime: Server Error (%d): %s\n", mysql_errno(&conn->handle), mysql_error(&conn->handle));
goto reconnect_tryagain;
}
- conn->connected = 1;
- conn->connect_time = time(NULL);
+ if (!conn->connected) {
+ conn->connected = 1;
+ conn->connect_time = time(NULL);
+ }
if (mysql_select_db(&conn->handle, conn->name) != 0) {
ast_log(LOG_WARNING, "MySQL RealTime: Unable to select database: %s. Still Connected (%u) - %s.\n", conn->name, mysql_errno(&conn->handle), mysql_error(&conn->handle));
@@ -1660,7 +1664,7 @@ static char *handle_cli_realtime_mysql_cache(struct ast_cli_entry *e, int cmd, s
AST_LIST_TRAVERSE(&cur->columns, col, list) {
ast_cli(a->fd, "%-20.20s %-20.20s %3d\n", col->name, col->type, col->len);
}
- ast_mutex_unlock(&cur->lock);
+ release_table(cur);
} else {
ast_cli(a->fd, "No such table '%s'\n", a->argv[3]);
}