<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9208">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Dialplan functions: Fix some channel autoservice misuse.<br><br>* Fix off nominal paths leaving the channel in autoservice.<br>* Remove unnecessary start/stop channel autoservice.<br>* Fix channel locking around a channel datastore search.<br><br>Change-Id: I7ff2e42388064fe3149034ecae57604040b8b540<br>---<br>M funcs/func_curl.c<br>M funcs/func_realtime.c<br>M main/enum.c<br>3 files changed, 19 insertions(+), 15 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/9208/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/funcs/func_curl.c b/funcs/func_curl.c<br>index 682ad5a..9e8f882 100644<br>--- a/funcs/func_curl.c<br>+++ b/funcs/func_curl.c<br>@@ -672,14 +672,19 @@<br> }<br> AST_LIST_UNLOCK(&global_curl_info);<br> <br>- if (chan && (store = ast_channel_datastore_find(chan, &curl_info, NULL))) {<br>- list = store->data;<br>- AST_LIST_LOCK(list);<br>- AST_LIST_TRAVERSE(list, cur, list) {<br>- if (cur->key == CURLOPT_SPECIAL_HASHCOMPAT) {<br>- hashcompat = (long) cur->value;<br>- } else {<br>- curl_easy_setopt(*curl, cur->key, cur->value);<br>+ if (chan) {<br>+ ast_channel_lock(chan);<br>+ store = ast_channel_datastore_find(chan, &curl_info, NULL);<br>+ ast_channel_unlock(chan);<br>+ if (store) {<br>+ list = store->data;<br>+ AST_LIST_LOCK(list);<br>+ AST_LIST_TRAVERSE(list, cur, list) {<br>+ if (cur->key == CURLOPT_SPECIAL_HASHCOMPAT) {<br>+ hashcompat = (long) cur->value;<br>+ } else {<br>+ curl_easy_setopt(*curl, cur->key, cur->value);<br>+ }<br> }<br> }<br> }<br>diff --git a/funcs/func_realtime.c b/funcs/func_realtime.c<br>index e0ba4a5..ef7fe2a 100644<br>--- a/funcs/func_realtime.c<br>+++ b/funcs/func_realtime.c<br>@@ -225,6 +225,9 @@<br> <br> if (resultslen > len) {<br> ast_log(LOG_WARNING, "Failed to fetch. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);<br>+ if (chan) {<br>+ ast_autoservice_stop(chan);<br>+ }<br> return -1;<br> }<br> <br>@@ -458,6 +461,9 @@<br> * someones data without giving him the chance to look<br> * at it. */<br> ast_log(LOG_WARNING, "Failed to fetch/destroy. Realtime data is too large: need %zu, have %zu.\n", resultslen, len);<br>+ if (chan) {<br>+ ast_autoservice_stop(chan);<br>+ }<br> return -1;<br> }<br> <br>diff --git a/main/enum.c b/main/enum.c<br>index a44a60c..8b6d3fe 100644<br>--- a/main/enum.c<br>+++ b/main/enum.c<br>@@ -941,10 +941,6 @@<br> <br> ast_debug(4, "ast_get_txt: Number = '%s', suffix = '%s'\n", number, suffix);<br> <br>- if (chan && ast_autoservice_start(chan) < 0) {<br>- return -1;<br>- }<br>-<br> if (pos > 128) {<br> pos = 128;<br> }<br>@@ -964,9 +960,6 @@<br> ret = 0;<br> } else {<br> ast_copy_string(txt, context.txt, txtlen);<br>- }<br>- if (chan) {<br>- ret |= ast_autoservice_stop(chan);<br> }<br> return ret;<br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9208">change 9208</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9208"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I7ff2e42388064fe3149034ecae57604040b8b540 </div>
<div style="display:none"> Gerrit-Change-Number: 9208 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>