aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-23 18:15:41 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-23 18:15:41 +0000
commitd8c42eae048943dcea92c58a31b428f2e8197afc (patch)
treed27bf0f2e0d8b15f4304d1702430c141fc6d3432 /res
parent01115d6d20eb5fa484aa40435bf885fc83124d9f (diff)
Merged revisions 118129 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r118129 | tilghman | 2008-05-23 13:09:14 -0500 (Fri, 23 May 2008) | 3 lines Protect the object from changing while the 'odbc show' CLI command is running (Closes issue #12704) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@118130 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_odbc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/res/res_odbc.c b/res/res_odbc.c
index 34d905b55..3e0a205ee 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -391,7 +391,9 @@ static char *handle_cli_odbc_show(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli(a->fd, " Pooled: Yes\n Limit: %d\n Connections in use: %d\n", class->limit, class->count);
AST_LIST_TRAVERSE(&(class->odbc_obj), current, list) {
+ ast_mutex_lock(&current->lock);
ast_cli(a->fd, " - Connection %d: %s\n", ++count, current->used ? "in use" : current->up && ast_odbc_sanity_check(current) ? "connected" : "disconnected");
+ ast_mutex_unlock(&current->lock);
}
} else {
/* Should only ever be one of these */
@@ -465,7 +467,9 @@ struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
/* Recycle connections before building another */
AST_LIST_TRAVERSE(&class->odbc_obj, obj, list) {
if (! obj->used) {
+ ast_mutex_lock(&obj->lock);
obj->used = 1;
+ ast_mutex_unlock(&obj->lock);
break;
}
}