Marco Spinetti wrote:
> ./testall -v testsockets Partial APR Tests: Socket Creation: ..FFF.
6 tests run: 3 passed, 3 failed, 0 not implemented.
Failed tests in Socket Creation: 1) tcp6_socket: expected <0> but was <97> 2) udp6_socket: expected <0> but was <97> 3) sendto_receivefrom: expected <0> but was <97>
Ignore this for now... testsockets problem (needs to deal with inability to get IPv6 sockets)
> ./testall -v testtime Partial APR Tests: Time: ..F....F....
12 tests run: 10 passed, 2 failed, 0 not implemented.
Failed tests in Time: 1) test_localstr: expected ----> 2002-08-14 12:05:36.186711 -25200 [257 Sat] DST <---- but saw ----> 2002-08-14 21:05:36.186711 +7200 [257 Sat] DST <---- 2) test_ctime: expected ----> Sat Sep 14 12:05:36 2002 <---- but saw ----> Sat Sep 14 21:05:36 2002 <----
this was a test driver (not APR) problem fixed on Nov 24th... if you're using newer code than Nov 24th, let us know
I have enclose between ** what it seems starnge to me.
>./testsock
apr_socket_sendfile()->0, sent 25988 bytes
After apr_socket_sendfile(), the kernel file pointer is at offset 0.
***********apr_socket_recv()->11/Resource temporarily unavailable (expected APR_EOF)*******************
The problem is that the test program had a non-blocking socket and didn't handle the case that the peer might not have already closed the socket by the time apr_socket_recv() was called. So depending on timing , the apr_socket_recv() could get APR_EAGAIN instead of APR_EOF.
Try this patch. This is to APR HEAD... slightly different patch may be necessary for APR_0_9_BRANCH.
Index: sendfile.c
===================================================================
RCS file: /home/cvs/apr/test/sendfile.c,v
retrieving revision 1.28
diff -u -r1.28 sendfile.c
--- sendfile.c 24 Nov 2003 13:22:46 -0000 1.28
+++ sendfile.c 9 Jan 2004 17:56:22 -0000
@@ -484,6 +484,16 @@
exit(1);
}+ /* set socket timeout now; we're just waiting for EOF */
+
+ rv = apr_socket_timeout_set(sock, apr_time_from_sec(3));
+ if (rv != APR_SUCCESS) {
+ fprintf(stderr, "apr_socket_timeout_set()->%d/%s\n",
+ rv,
+ apr_strerror(rv, buf, sizeof buf));
+ exit(1);
+ }
+
bytes_read = 1;
rv = apr_socket_recv(sock, buf, &bytes_read);
if (rv != APR_EOF) {