[asterisk-dev] [svn-commits] elguero: branch 11 r381893 - /branches/11/res/res_agi.c

Paul Belanger paul.belanger at polybeacon.com
Fri Feb 22 14:50:04 CST 2013

On 13-02-22 02:38 PM, SVN commits to the Digium repositories wrote:
> Author: elguero
> Date: Fri Feb 22 13:38:06 2013
> New Revision: 381893
> URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381893
> Log:
> Fix FastAGI To Properly Check For A Connection
> When IPv6 support was added to FastAGI, the intent was to have the ability to
> check all addresses resolved for a host since we might receive an IPv4 address
> and an IPv6 address.  The problem with the current code, is that, since we are
> doing O_NONBLOCK, we get EINPROGRESS when calling ast_connect() but are ignoring
> this instead of handling it.  We break out of the loop and continue on.  When we
> later call ast_poll(), it succeeds but we never check if we have a connection or
> not on the socket level.  We then attempt to send data to the host address that
> we think is setup and it fails.  We then check the errno and see that we have
> "connection refused" and then return with agi failed.
> This patch does the following:
> * Handles EINPROGRESS by creating the function handle_connection()
>    - ast_poll() was moved into this function
>    - This function checks the results of the connection on the socket level after
>      calling ast_poll()
> * Continues to the next address if the above fails to create a connection
> * Once all addresses resolved are tried and we still are unable to establish a
>    connection, then we return that the FastAGI call failed
> (closes issue ASTERISK-21065)
> Reported by: Jeremy Kister
> Tested by: Jeremy Kister, Michael L. Young
> Patches:
>    asterisk-21065_poll_correctly_v4.diff Michael L. Young (license 5026)
> Review: https://reviewboard.asterisk.org/r/2330/
> Modified:
>      branches/11/res/res_agi.c
We should at lest modify one of the existing fastagi tests in the 
testsuite to test IPv6, to test.

Paul Belanger | PolyBeacon, Inc.
Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode)
Github: https://github.com/pabelanger | Twitter: 

More information about the asterisk-dev mailing list