httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <di...@covalent.net>
Subject server/listen.c / alloc_listen() does not pass back errors ?
Date Mon, 17 Dec 2001 10:13:10 GMT

Confused about 2.0 - could someone who has stayed current with the tide
help me understand here :-)

When coming across a Listen: in the config we call ap_set_listener() which
calls (void) alloc_listener() to get the actual socket() opened:

const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips)
{
	...
	alloc_listener();
	return;
}

The funcition alloc_listen() seems to be only used within the above
function. I.e. just during config read.

However it contains things like:

void alloc_listner()
{
    ...
    if ((status = apr_socket_create(&new->sd, new->bind_addr->sa.sin.sin_family,
                                    SOCK_STREAM, process->pool)) != APR_SUCCESS) {
        ap_log_perror(APLOG_MARK, APLOG_CRIT, status, process->pool,
                     "alloc_listener: failed to get a socket for %s", addr);
        return;
    }

to trap errors.

Now it is not clear to me that ap_log_error() at that point already logs
things that reliably to the right log file that early during parse ? Or am
I making some apache 1.3 assumption which no longer holds ?

And secondly, like all good config routines; ap_set_listener() kind of
expects a "error string" as the return value. So any reason not to let
alloc_listener() return a char *; and let ap_set_listnener end with

	return alloc_listener();

so that we can barf with an error on "Listen foem:1234" ?

Dw


Mime
View raw message