diff options
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; } } |