[asterisk-commits] russell: trunk r81262 - in /trunk: funcs/func_enum.c pbx/pbx_dundi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 28 13:41:18 CDT 2007
Author: russell
Date: Tue Aug 28 13:41:18 2007
New Revision: 81262
URL: http://svn.digium.com/view/asterisk?view=rev&rev=81262
Log:
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.
Modified:
trunk/funcs/func_enum.c
trunk/pbx/pbx_dundi.c
Modified: trunk/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_enum.c?view=diff&rev=81262&r1=81261&r2=81262
==============================================================================
--- trunk/funcs/func_enum.c (original)
+++ trunk/funcs/func_enum.c Tue Aug 28 13:41:18 2007
@@ -201,7 +201,9 @@
datastore->data = erds;
+ ast_channel_lock(chan);
ast_channel_datastore_add(chan, datastore);
+ ast_channel_unlock(chan);
res = 0;
@@ -246,7 +248,10 @@
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");
goto finish;
}
Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=81262&r1=81261&r2=81262
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Tue Aug 28 13:41:18 2007
@@ -3934,7 +3934,9 @@
if (drds->num_results > 0)
sort_results(drds->results, drds->num_results);
+ ast_channel_lock(chan);
ast_channel_datastore_add(chan, datastore);
+ ast_channel_unlock(chan);
ast_module_user_remove(u);
@@ -3991,11 +3993,16 @@
ast_log(LOG_ERROR, "A result number must be given to DUNDIRESULT!\n");
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);
goto finish;
}
+
drds = datastore->data;
if (!strcasecmp(args.resultnum, "getnum")) {
More information about the asterisk-commits
mailing list