You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2013/10/14 15:45:05 UTC

svn commit: r1531894 - in /apr/apr/branches/1.5.x: ./ test/sendfile.c

Author: trawick
Date: Mon Oct 14 13:45:05 2013
New Revision: 1531894

URL: http://svn.apache.org/r1531894
Log:
Merge r1531884 from trunk:

Close socket and get a new one before retrying apr_socket_connect(),
resolving an intermittent EINVAL failure from connect() on FreeBSD.

Modified:
    apr/apr/branches/1.5.x/   (props changed)
    apr/apr/branches/1.5.x/test/sendfile.c

Propchange: apr/apr/branches/1.5.x/
------------------------------------------------------------------------------
  Merged /apr/apr/trunk:r1531884

Modified: apr/apr/branches/1.5.x/test/sendfile.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/test/sendfile.c?rev=1531894&r1=1531893&r2=1531894&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/test/sendfile.c (original)
+++ apr/apr/branches/1.5.x/test/sendfile.c Mon Oct 14 13:45:05 2013
@@ -208,8 +208,6 @@ static int client(apr_pool_t *p, client_
         connect_tries = 5; /* give it a chance to start up */
     }
 
-    family = APR_INET;
-    apr_setup(p, &sock, &family);
     create_testfile(p, TESTFILE);
 
     rv = apr_file_open(&f, TESTFILE, APR_FOPEN_READ, 0, p);
@@ -220,14 +218,20 @@ static int client(apr_pool_t *p, client_
     if (!host) {
         host = "127.0.0.1";
     }
+    family = APR_INET;
     rv = apr_sockaddr_info_get(&destsa, host, family, TESTSF_PORT, 0, p);
     if (rv != APR_SUCCESS) {
         aprerr("apr_sockaddr_info_get()", rv);
     }
 
     while (connect_tries--) {
+        apr_setup(p, &sock, &family);
         rv = apr_socket_connect(sock, destsa);
         if (connect_tries && APR_STATUS_IS_ECONNREFUSED(rv)) {
+            apr_status_t tmprv = apr_socket_close(sock);
+            if (tmprv != APR_SUCCESS) {
+                aprerr("apr_socket_close()", tmprv);
+            }
             apr_sleep(connect_retry_interval);
             connect_retry_interval *= 2;
         }