httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Reid" <ab...@dial.pipex.com>
Subject [PATCH] APR socket timeouts...
Date Sun, 03 Oct 1999 20:18:15 GMT
I couldn't figure out why the testsock test was failing constantly on 
BeOS.  It looked like a synchronisation issue, which it didn't have 
before!  Of course it was the timeouts!  I realised that there isn't 
actually code to get/set the timeout into the socket structure, so here 
are some.

Addition to apr_network_io.h
ap_status_t ap_settimeout(ap_socket_t *, ap_uint32_t );
ap_status_t ap_gettimeout(ap_socket_t *, ap_uint32_t *); 

Addition to sockets.c
ap_status_t ap_settimeout(struct socket_t *sock, ap_uint32_t time) 
{
    sock->timeout = time;
    return APR_SUCCESS;
}

ap_status_t ap_gettimeout(struct socket_t *sock, ap_uint32_t *time) 
{
    *time = sock->timeout;
    return APR_SUCCESS;
}

This code goes into the client.c test program...
    fprintf(stdout, "\tClient:  Setting timeout for socket.....");
    if (ap_settimeout(sock, 5) != APR_SUCCESS) {
        fprintf(stderr,"Failed!\n***The test may fail, but it's not 
fatal***\n");
    } else 
        fprintf(stdout,"OK\n");

I haven't failed the test because the timeout couldn't be set, just 
warned the user.  the reason is that the code performs fine without a 
timeout on FreeBSD 3.3.  I'd guess it's the frenetic pace of BeOS 
threads that's causing the problem.

david

Mime
View raw message