On Thu, Aug 26, 2010 at 1:02 AM, <[email protected]> wrote:

> Author: mturk
> Date: Thu Aug 26 05:02:33 2010
> New Revision: 989443
>
> URL: http://svn.apache.org/viewvc?rev=989443&view=rev
> Log:
> Loop if the recv gets WSAEWOULDBLOCK
>

ordinarily I'd think loop-while-EWOULDBLOCK would be an undesirable busy
loop

why is this a special case?



>
> Modified:
>    apr/apr/trunk/file_io/win32/pipe.c
>
> Modified: apr/apr/trunk/file_io/win32/pipe.c
> URL:
> http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/pipe.c?rev=989443&r1=989442&r2=989443&view=diff
>
> ==============================================================================
> --- apr/apr/trunk/file_io/win32/pipe.c (original)
> +++ apr/apr/trunk/file_io/win32/pipe.c Thu Aug 26 05:02:33 2010
> @@ -321,7 +321,11 @@ static apr_status_t create_socket_pipe(S
>         }
>         /* Verify the connection by reading the send identification.
>          */
> -        nrd = recv(*rd, (char *)iid, sizeof(iid), 0);
> +        do {
> +            nrd = recv(*rd, (char *)iid, sizeof(iid), 0);
> +            rv = nrd == SOCKET_ERROR ? apr_get_netos_error() :
> APR_SUCCESS;
> +        } while (APR_STATUS_IS_EAGAIN(rv));
> +
>         if (nrd == sizeof(iid)) {
>             if (memcmp(uid, iid, sizeof(uid)) == 0) {
>                 /* Wow, we recived what we send.
> @@ -337,7 +341,6 @@ static apr_status_t create_socket_pipe(S
>             }
>         }
>         else if (nrd == SOCKET_ERROR) {
> -            rv =  apr_get_netos_error();
>             goto cleanup;
>         }
>         closesocket(*rd);
>
>
>


-- 
Born in Roswell... married an alien...

Reply via email to