[asterisk-bugs] [JIRA] Issue Comment Edited: (ASTERISK-20109) get_ast_cmd doesn't differentiate between failure and empty list return

Matt Jordan (JIRA) noreply at issues.asterisk.org
Tue Sep 18 12:40:27 CDT 2012


    [ https://issues.asterisk.org/jira/browse/ASTERISK-20109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=197249#comment-197249 ] 

Matt Jordan edited comment on ASTERISK-20109 at 9/18/12 12:40 PM:
------------------------------------------------------------------

If that's the case, then you probably don't need to change {{get_agi_cmd}} at all.  You probably only need:

{noformat}
+			if (!cmd) {
+				ast_log(LOG_ERROR, "Failed to get AGI command on channel %s: %s\n",chan->name,strerror(errno));
+				returnstatus = AGI_RESULT_FAILURE;
+				goto async_agi_done;
+			}
{noformat}

After the while() loop itself.

      was (Author: mjordan):
    If that's the case, then you probably don't need to change {{get_agi_cmd}} at all.  You probably only need:

{noformat}
+			if (!cmd) {
+				ast_log(LOG_ERROR, "Failed to get AGI command on channel %s: %s\n",chan->name,strerror(errno));
+				returnstatus = AGI_RESULT_FAILURE;
+				goto async_agi_done;
+			}
{noformat}
  
> get_ast_cmd doesn't differentiate between failure and empty list return
> -----------------------------------------------------------------------
>
>                 Key: ASTERISK-20109
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20109
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_agi
>    Affects Versions: 10.5.1
>         Environment: openSuSE 11.4 64bit on Dell M610 blade
>            Reporter: Jeremiah Gowdy
>            Assignee: Rusty Newton
>            Severity: Minor
>         Attachments: jgowdy-7-9-2012.diff
>
>
> In res_agi, the get_ast_cmd method returns NULL in the case of "Async AGI datastore disappeared" and in the fairly normal case of empty work list.  In the current code, when the datastore disappears (which I've yet to determine why), the at least one of the channels in the associated bridge tend to survive for approximately 30 seconds with repeated broken pipe errors.
> By changing the return value to int and taking the struct pointer by pointer, we are able to properly convey the different conditions to the caller, and thus fail much more quickly.  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list