apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r833907 - /apr/apr/trunk/test/testsock.c
Date Sun, 08 Nov 2009 18:14:37 GMT
Author: trawick
Date: Sun Nov  8 18:14:37 2009
New Revision: 833907

URL: http://svn.apache.org/viewvc?rev=833907&view=rev
Log:
don't assume child process can both connect and close before parent can
both accept and look for EOF

(fixes intermittent failure seen on Linux and OpenSolaris)


Modified:
    apr/apr/trunk/test/testsock.c

Modified: apr/apr/trunk/test/testsock.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testsock.c?rev=833907&r1=833906&r2=833907&view=diff
==============================================================================
--- apr/apr/trunk/test/testsock.c (original)
+++ apr/apr/trunk/test/testsock.c Sun Nov  8 18:14:37 2009
@@ -247,9 +247,14 @@
     rv = apr_socket_accept(&sock2, sock, p);
     APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv);
 
-    /* The child closed the socket instantly */
+    /* The child closed the socket as soon as it could... */
     rv = apr_socket_atreadeof(sock2, &atreadeof);
     APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #3", rv);
+    if (!atreadeof) { /* ... but perhaps not yet; wait a moment */
+        apr_sleep(apr_time_from_msec(5));
+        rv = apr_socket_atreadeof(sock2, &atreadeof);
+        APR_ASSERT_SUCCESS(tc, "Determine whether at EOF, #4", rv);
+    }
     ABTS_INT_EQUAL(tc, 1, atreadeof);
     wait_child(tc, &proc);
 



Mime
View raw message