Author: rhuijben
Date: Sun Nov 1 19:26:40 2015
New Revision: 1711843
URL: http://svn.apache.org/viewvc?rev=1711843&view=rev
Log:
Try to clean out a few valgrind errors in an attempt to find out what sometimes
fails on the bot.
* outgoing.c
(serf__open_connections): Register pool cleanup a bit later to allow us to
close the socket, without doing it *after* the socket's own cleanup closes
it.
* test/MockHTTPinC/MockHTTP_server.c
(setupTCPServer,
closeAndRemoveClientCtx,
_mhRunServerLoop): Clear socket to avoid double closes.
(sslHandshake): Handle another error code, often seen on FreeBSD in the same
place as where I see the other error on Windows with a newer openssl.
Modified:
serf/trunk/outgoing.c
serf/trunk/test/MockHTTPinC/MockHTTP_server.c
Modified: serf/trunk/outgoing.c
URL:
http://svn.apache.org/viewvc/serf/trunk/outgoing.c?rev=1711843&r1=1711842&r2=1711843&view=diff
==============================================================================
--- serf/trunk/outgoing.c (original)
+++ serf/trunk/outgoing.c Sun Nov 1 19:26:40 2015
@@ -436,9 +436,6 @@ apr_status_t serf__open_connections(serf
}
apr_pool_clear(conn->skt_pool);
- apr_pool_cleanup_register(conn->skt_pool, conn, clean_skt,
- apr_pool_cleanup_null);
-
status = apr_socket_create(&skt, conn->address->family,
SOCK_STREAM,
#if APR_MAJOR_VERSION > 0
@@ -450,6 +447,9 @@ apr_status_t serf__open_connections(serf
if (status != APR_SUCCESS)
return status;
+ apr_pool_cleanup_register(conn->skt_pool, conn, clean_skt,
+ apr_pool_cleanup_null);
+
/* Set the socket to be non-blocking */
if ((status = apr_socket_timeout_set(skt, 0)) != APR_SUCCESS)
return status;
Modified: serf/trunk/test/MockHTTPinC/MockHTTP_server.c
URL:
http://svn.apache.org/viewvc/serf/trunk/test/MockHTTPinC/MockHTTP_server.c?rev=1711843&r1=1711842&r2=1711843&view=diff
==============================================================================
--- serf/trunk/test/MockHTTPinC/MockHTTP_server.c (original)
+++ serf/trunk/test/MockHTTPinC/MockHTTP_server.c Sun Nov 1 19:26:40 2015
@@ -223,6 +223,7 @@ static apr_status_t setupTCPServer(mhSer
status = apr_socket_bind(ctx->skt, serv_addr);
if (status != APR_SUCCESS) {
apr_socket_close(ctx->skt);
+ ctx->skt = NULL;
ctx->port++;
continue;
}
@@ -1525,6 +1526,7 @@ static void closeAndRemoveClientCtx(mhSe
pfd.reqevents = cctx->reqevents;
apr_pollset_remove(ctx->pollset, &pfd);
apr_socket_close(cctx->skt);
+ cctx->skt = NULL;
if (cctx->proxyskt) {
pfd.desc_type = APR_POLL_SOCKET;
@@ -1532,6 +1534,7 @@ static void closeAndRemoveClientCtx(mhSe
pfd.reqevents = cctx->proxyreqevents;
apr_pollset_remove(ctx->pollset, &pfd);
apr_socket_close(cctx->proxyskt);
+ cctx->proxyskt = NULL;
}
/* TODO: a linked list would be more efficient. */
@@ -1632,6 +1635,7 @@ apr_status_t _mhRunServerLoop(mhServCtx_
pfd.reqevents = cctx->proxyreqevents;
apr_pollset_remove(ctx->pollset, &pfd);
apr_socket_close(cctx->proxyskt);
+ cctx->proxyskt = NULL;
}
} else {
@@ -2896,7 +2900,8 @@ static apr_status_t sslHandshake(_mhClie
int reason = ERR_GET_REASON(l);
if (lib == ERR_LIB_SSL
- && reason == SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE) {
+ && (reason == SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE
+ || reason == ERR_R_INTERNAL_ERROR)) {
/* The server shouldn't fail for this...
We test the client. Go on, and report the problem