diff options
author | Nick Kew <niq@apache.org> | 2009-08-20 01:55:14 +0200 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2009-08-20 01:55:14 +0200 |
commit | b102bce05cf95bfbc278cef95ea92e901bd2669e (patch) | |
tree | d567e93caf92bc4de5bfc48772e3ac1b1e63cf5d /server/listen.c | |
parent | Clarification on unit of measure of %D in mod_headers (diff) | |
download | apache2-b102bce05cf95bfbc278cef95ea92e901bd2669e.tar.xz apache2-b102bce05cf95bfbc278cef95ea92e901bd2669e.zip |
Don't require all listeners to be created equal ...
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@806010 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/listen.c')
-rw-r--r-- | server/listen.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/server/listen.c b/server/listen.c index 8361fb3c35..4a23715065 100644 --- a/server/listen.c +++ b/server/listen.c @@ -234,7 +234,8 @@ static apr_status_t close_listeners_on_exec(void *v) } static const char *alloc_listener(process_rec *process, char *addr, - apr_port_t port, const char* proto) + apr_port_t port, const char* proto, + void *dummy) { ap_listen_rec **walk, *last; apr_status_t status; @@ -269,6 +270,9 @@ static const char *alloc_listener(process_rec *process, char *addr, } if (found_listener) { + if (ap_listeners->slave != dummy) { + return "Cannot define a slave on the same IP:port as a Listener"; + } return NULL; } @@ -326,6 +330,7 @@ static const char *alloc_listener(process_rec *process, char *addr, last->next = new; last = new; } + new->slave = dummy; } return NULL; @@ -581,6 +586,22 @@ AP_DECLARE_NONSTD(void) ap_close_listeners(void) lr->active = 0; } } +AP_DECLARE_NONSTD(int) ap_close_selected_listeners(ap_slave_t *slave) +{ + ap_listen_rec *lr; + int n = 0; + + for (lr = ap_listeners; lr; lr = lr->next) { + if (lr->slave != slave) { + apr_socket_close(lr->sd); + lr->active = 0; + } + else { + ++n; + } + } + return n; +} AP_DECLARE(void) ap_listen_pre_config(void) { @@ -589,7 +610,10 @@ AP_DECLARE(void) ap_listen_pre_config(void) ap_listenbacklog = DEFAULT_LISTENBACKLOG; } - +/* Hack: populate an extra field + * When this gets called from a Listen directive, dummy is null. + * So we can use non-null dummy to pass a data pointer without conflict + */ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, int argc, char *const argv[]) { @@ -636,7 +660,7 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy, ap_str_tolower(proto); } - return alloc_listener(cmd->server->process, host, port, proto); + return alloc_listener(cmd->server->process, host, port, proto, dummy); } AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, |