Author: rhuijben Date: Thu Oct 29 10:48:34 2015 New Revision: 1711216 URL: http://svn.apache.org/viewvc?rev=1711216&view=rev Log: Tweak port number handling in MockHTTP server to resolve some warnings and to handle other apr_socket_bind() errors.
* test/MockHTTPinC/MockHTTP_server.c (DefaultSrvPort, DefaultProxyPort, DefaultOCSPResponderPort): Use apr_port_t. (setupTCPServer): Handle any bind error as retry trigger. This function is not guaranteed to return that error code. Modified: serf/trunk/test/MockHTTPinC/MockHTTP_server.c Modified: serf/trunk/test/MockHTTPinC/MockHTTP_server.c URL: http://svn.apache.org/viewvc/serf/trunk/test/MockHTTPinC/MockHTTP_server.c?rev=1711216&r1=1711215&r2=1711216&view=diff ============================================================================== --- serf/trunk/test/MockHTTPinC/MockHTTP_server.c (original) +++ serf/trunk/test/MockHTTPinC/MockHTTP_server.c Thu Oct 29 10:48:34 2015 @@ -71,9 +71,9 @@ typedef apr_status_t (*receive_func_t)(a typedef struct sslCtx_t sslCtx_t; typedef struct bucket_t bucket_t; -static const int DefaultSrvPort = 30080; -static const int DefaultProxyPort = 38080; -static const int DefaultOCSPResponderPort = 39080; +static const apr_port_t DefaultSrvPort = 30080; +static const apr_port_t DefaultProxyPort = 38080; +static const apr_port_t DefaultOCSPResponderPort = 39080; /* Buffer size for incoming and outgoing data */ #define BUFSIZE 32768 @@ -209,7 +209,8 @@ static apr_status_t setupTCPServer(mhSer /* Try the next port until bind succeeds */ status = apr_socket_bind(ctx->skt, serv_addr); - if (status == EADDRINUSE) { + if (status != APR_SUCCESS) { + apr_socket_close(ctx->skt); ctx->port++; continue; }