httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r239710 - in /httpd/httpd/trunk: include/ap_listen.h server/listen.c
Date Wed, 24 Aug 2005 16:51:24 GMT
Author: colm
Date: Wed Aug 24 09:51:20 2005
New Revision: 239710

URL: http://svn.apache.org/viewcvs?rev=239710&view=rev
Log:

Provide a function for closing all of the listeners. 

  * 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.


Modified:
    httpd/httpd/trunk/include/ap_listen.h
    httpd/httpd/trunk/server/listen.c

Modified: httpd/httpd/trunk/include/ap_listen.h
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/include/ap_listen.h?rev=239710&r1=239709&r2=239710&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_listen.h (original)
+++ httpd/httpd/trunk/include/ap_listen.h Wed Aug 24 09:51:20 2005
@@ -77,6 +77,11 @@
  */ 
 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

Modified: httpd/httpd/trunk/server/listen.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/server/listen.c?rev=239710&r1=239709&r2=239710&view=diff
==============================================================================
--- httpd/httpd/trunk/server/listen.c (original)
+++ httpd/httpd/trunk/server/listen.c Wed Aug 24 09:51:20 2005
@@ -238,17 +238,10 @@
 
 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)
 {
@@ -539,6 +532,15 @@
     }
 
     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)



Mime
View raw message