httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-2.0/src/main listen.c
Date Fri, 24 Sep 1999 22:01:25 GMT
manoj       99/09/24 15:01:23

  Modified:    src/include ap_listen.h
               src/main listen.c
  Log:
  Restarts were hosed after the APR changes because we were opening
  sockets even when we had them open already. So, for now, add an "active"
  flag that indicates whether the socket stored in the listen_rec is an
  actual open socket yet.
  
  Revision  Changes    Path
  1.6       +1 -0      apache-2.0/src/include/ap_listen.h
  
  Index: ap_listen.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_listen.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- ap_listen.h	1999/09/08 14:15:40	1.5
  +++ ap_listen.h	1999/09/24 22:01:17	1.6
  @@ -64,6 +64,7 @@
   struct ap_listen_rec {
       ap_listen_rec *next;
       ap_socket_t *sd;
  +    int active;
   /* more stuff here, like which protocol is bound to the port */
   };
   
  
  
  
  1.9       +13 -3     apache-2.0/src/main/listen.c
  
  Index: listen.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/listen.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -d -u -r1.8 -r1.9
  --- listen.c	1999/09/18 11:48:17	1.8
  +++ listen.c	1999/09/24 22:01:21	1.9
  @@ -134,6 +134,7 @@
       }
   
       server->sd = s;
  +    server->active = 1;
       return APR_SUCCESS;
   }
   
  @@ -144,6 +145,7 @@
   
       for (lr = ap_listeners; lr; lr = lr->next) {
   	ap_close_socket(lr->sd);
  +	lr->active = 0;
       }
       return APR_SUCCESS;
   }
  @@ -171,7 +173,9 @@
       }
   
       /* this has to survive restarts */
  +    /* XXX - We need to deal with freeing this structure properly. */
       new = malloc(sizeof(ap_listen_rec));
  +    new->active = 0;
       if (ap_create_tcp_socket(NULL, &new->sd) != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_CRIT, NULL,
                    "make_sock: failed to get a socket for %s", addr);
  @@ -189,7 +193,7 @@
       ap_listen_rec *lr;
       ap_listen_rec *next;
       int num_open;
  -    ap_status_t stat;
  +
       /* allocate a default listener if necessary */
       if (ap_listeners == NULL) {
   	alloc_listener(APR_ANYADDR, port ? port : DEFAULT_HTTP_PORT);
  @@ -197,15 +201,21 @@
   
       num_open = 0;
       for (lr = ap_listeners; lr; lr = lr->next) {
  -	stat = make_sock(pconf, lr);
  -	if (stat == APR_SUCCESS) {
  +	if (lr->active) {
   	    ++num_open;
   	}
  +	else {
  +	    if (make_sock(pconf, lr) == APR_SUCCESS) {
  +		++num_open;
  +		lr->active = 1;
  +	    }
  +	}
       }
   
       /* close the old listeners */
       for (lr = old_listeners; lr; lr = next) {
   	ap_close_socket(lr->sd);
  +	lr->active = 0;
   	next = lr->next;
   /*	free(lr);*/
       }
  
  
  

Mime
View raw message