* This is useful for properly implementing a graceful stop and restart
where we want child processess to be able to carry on serving a request
but "de-listen" from a port. So that another instance entirely can be
started in our place, or to unbind from a "Listen" directive an admin
has removed from the configuration.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@239710
13f79535-47bb-0310-9956-
ffa450edef68
*/
AP_DECLARE(int) ap_setup_listeners(server_rec *s);
+/**
+ * Loop through the global ap_listen_rec list and close each of the sockets.
+ */
+AP_DECLARE_NONSTD(void) ap_close_listeners();
+
/* Although these functions are exported from libmain, they are not really
* public functions. These functions are actually called while parsing the
* config file, when one of the LISTEN_COMMANDS directives is read. These
static apr_status_t close_listeners_on_exec(void *v)
{
- ap_listen_rec *lr;
-
- for (lr = ap_listeners; lr; lr = lr->next) {
- apr_socket_close(lr->sd);
- lr->active = 0;
- }
-
+ ap_close_listeners();
return APR_SUCCESS;
}
-
static const char *alloc_listener(process_rec *process, char *addr,
apr_port_t port, const char* proto)
{
return num_listeners;
}
+AP_DECLARE_NONSTD(void) ap_close_listeners() {
+ ap_listen_rec *lr;
+
+ for (lr = ap_listeners; lr; lr = lr->next) {
+ apr_socket_close(lr->sd);
+ lr->active = 0;
+ }
+}
+
AP_DECLARE(void) ap_listen_pre_config(void)
{
old_listeners = ap_listeners;