Author: rpluem Date: Fri Aug 20 14:29:10 2010 New Revision: 987524 URL: http://svn.apache.org/viewvc?rev=987524&view=rev Log: Merge r793193 from trunk: Fix apr_socket_addr_get() in combination with async connects, for the APR_LOCAL case. Before it would return 0.0.0.0:0, instead of the actual local address/port. TODO: Fix win32 in a similar fashion; though maybe it's better to assume the local address is unknown by default... * network_io/unix/sockets.c (apr_socket_connect): Move address determination, or rather determining that the local address is unknown, to before returning because of e.g. EINPROGRESS. Submitted by: striker Reviewed by: rpluem Modified: apr/apr/branches/1.5.x/ (props changed) apr/apr/branches/1.5.x/network_io/unix/sockets.c Propchange: apr/apr/branches/1.5.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Aug 20 14:29:10 2010 @@ -1 +1 @@ -/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838 +/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838 Modified: apr/apr/branches/1.5.x/network_io/unix/sockets.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sockets.c?rev=987524&r1=987523&r2=987524&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/unix/sockets.c (original) +++ apr/apr/branches/1.5.x/network_io/unix/sockets.c Fri Aug 20 14:29:10 2010 @@ -338,9 +338,6 @@ apr_status_t apr_socket_connect(apr_sock #endif /* SO_ERROR */ } - if (rc == -1 && errno != EISCONN) { - return errno; - } if (memcmp(sa->ipaddr_ptr, generic_inaddr_any, sa->ipaddr_len)) { /* A real remote address was passed in. If the unspecified @@ -364,6 +361,11 @@ apr_status_t apr_socket_connect(apr_sock */ sock->local_interface_unknown = 1; } + + if (rc == -1 && errno != EISCONN) { + return errno; + } + #ifndef HAVE_POLL sock->connected=1; #endif