apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r376484 - /apr/apr/branches/1.2.x/test/testsock.c
Date Thu, 09 Feb 2006 23:18:52 GMT
Author: wrowe
Date: Thu Feb  9 15:18:50 2006
New Revision: 376484

URL: http://svn.apache.org/viewcvs?rev=376484&view=rev
Log:

  Avoid a hang if apr_accept() fails, permitting APR_EINPROGRESS
  while we wait for apr_connect()

Backports; 376196, 376403
Author; rooneg

Modified:
    apr/apr/branches/1.2.x/test/testsock.c

Modified: apr/apr/branches/1.2.x/test/testsock.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testsock.c?rev=376484&r1=376483&r2=376484&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/test/testsock.c (original)
+++ apr/apr/branches/1.2.x/test/testsock.c Thu Feb  9 15:18:50 2006
@@ -212,7 +212,7 @@
     apr_status_t rv;
     apr_socket_t *ld, *sd, *cd;
     apr_sockaddr_t *sa, *ca;
-    char a[128], b[128];
+    char *a, *b;
 
     ld = setup_socket(tc);
 
@@ -226,9 +226,11 @@
 
     APR_ASSERT_SUCCESS(tc, "enable non-block mode",
                        apr_socket_opt_set(cd, APR_SO_NONBLOCK, 1));
-    
-    /* initiate connection */
-    apr_socket_connect(cd, sa);
+
+    rv = apr_socket_connect(cd, sa);
+    APR_ASSERT_SUCCESS(tc, "make the connection", rv);
+    if (rv)
+        return;
 
     APR_ASSERT_SUCCESS(tc, "accept connection",
                        apr_socket_accept(&sd, ld, p));
@@ -255,8 +257,8 @@
     APR_ASSERT_SUCCESS(tc, "get remote address of client socket",
                        apr_socket_addr_get(&ca, APR_REMOTE, cd));
     
-    apr_snprintf(a, sizeof a, "%pI", sa);
-    apr_snprintf(b, sizeof b, "%pI", ca);
+    a = apr_psprintf(p, "%pI", sa);
+    b = apr_psprintf(p, "%pI", ca);
 
     ABTS_STR_EQUAL(tc, a, b);
                        



Mime
View raw message