diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-23 18:15:41 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-23 18:15:41 +0000 |
commit | d8c42eae048943dcea92c58a31b428f2e8197afc (patch) | |
tree | d27bf0f2e0d8b15f4304d1702430c141fc6d3432 /res/res_odbc.c | |
parent | 01115d6d20eb5fa484aa40435bf885fc83124d9f (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/res_odbc.c')
-rw-r--r-- | res/res_odbc.c | 4 |
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(¤t->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(¤t->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; } } |