summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2009-11-08 19:54:46 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2009-11-08 19:54:46 +0000
commit660e7653383c1387267fb9faca1af586edf68d26 (patch)
tree985f98e7e6e13710e646bdf03c63943a765ce485
parent83cf27829e34c8a43be515076d3103f55007096e (diff)
downloadlibapr-660e7653383c1387267fb9faca1af586edf68d26.tar.gz
Merge r833907 from trunk:
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) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@833920 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--test/testsock.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/testsock.c b/test/testsock.c
index 1684ea655..b1115fd46 100644
--- a/test/testsock.c
+++ b/test/testsock.c
@@ -241,9 +241,14 @@ static void test_atreadeof(abts_case *tc, void *data)
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);