summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2004-01-09 18:14:52 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2004-01-09 18:14:52 +0000
commit8e1c997d6f474ffd9928c545579da344361d05a0 (patch)
treef41092dd9fe4fd2e62c2ac0997219617eca80333 /test
parentbbddad2a2cec6b8a27d2ce6042913dafc64775d3 (diff)
downloadlibapr-8e1c997d6f474ffd9928c545579da344361d05a0.tar.gz
before calling apr_socket_recv() and expecting to get EOF, make
sure there is a timeout on the socket in case the peer hasn't finished yet git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/APR_0_9_BRANCH@64866 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/sendfile.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/sendfile.c b/test/sendfile.c
index 95e5c3ad5..d6b1ab0a4 100644
--- a/test/sendfile.c
+++ b/test/sendfile.c
@@ -476,6 +476,17 @@ static int client(client_socket_mode_t socket_mode, char *host)
exit(1);
}
+ /* in case this is the non-blocking test, set socket timeout;
+ * 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) {