mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-22 13:25:17 +00:00
Add proper channel locking around the uses of datastore_add and _find. There
are still more places in the tree that I have not yet changed if someone wants to go through and find the places they are used without the channel locked. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81262 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -201,7 +201,9 @@ static int enum_query_read(struct ast_channel *chan, const char *cmd, char *data
|
|||||||
|
|
||||||
datastore->data = erds;
|
datastore->data = erds;
|
||||||
|
|
||||||
|
ast_channel_lock(chan);
|
||||||
ast_channel_datastore_add(chan, datastore);
|
ast_channel_datastore_add(chan, datastore);
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
@@ -246,7 +248,10 @@ static int enum_result_read(struct ast_channel *chan, const char *cmd, char *dat
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(datastore = ast_channel_datastore_find(chan, &enum_result_datastore_info, args.id))) {
|
ast_channel_lock(chan);
|
||||||
|
datastore = ast_channel_datastore_find(chan, &enum_result_datastore_info, args.id);
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
if (!datastore) {
|
||||||
ast_log(LOG_WARNING, "No ENUM results found for query id!\n");
|
ast_log(LOG_WARNING, "No ENUM results found for query id!\n");
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
@@ -3934,7 +3934,9 @@ static int dundi_query_read(struct ast_channel *chan, const char *cmd, char *dat
|
|||||||
if (drds->num_results > 0)
|
if (drds->num_results > 0)
|
||||||
sort_results(drds->results, drds->num_results);
|
sort_results(drds->results, drds->num_results);
|
||||||
|
|
||||||
|
ast_channel_lock(chan);
|
||||||
ast_channel_datastore_add(chan, datastore);
|
ast_channel_datastore_add(chan, datastore);
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
|
||||||
ast_module_user_remove(u);
|
ast_module_user_remove(u);
|
||||||
|
|
||||||
@@ -3992,10 +3994,15 @@ static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *da
|
|||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(datastore = ast_channel_datastore_find(chan, &dundi_result_datastore_info, args.id))) {
|
ast_channel_lock(chan);
|
||||||
|
datastore = ast_channel_datastore_find(chan, &dundi_result_datastore_info, args.id);
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
|
||||||
|
if (!datastore) {
|
||||||
ast_log(LOG_WARNING, "No DUNDi results found for query ID '%s'\n", args.id);
|
ast_log(LOG_WARNING, "No DUNDi results found for query ID '%s'\n", args.id);
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
drds = datastore->data;
|
drds = datastore->data;
|
||||||
|
|
||||||
if (!strcasecmp(args.resultnum, "getnum")) {
|
if (!strcasecmp(args.resultnum, "getnum")) {
|
||||||
|
Reference in New Issue
Block a user