httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@hyperreal.org
Subject cvs commit: apache-1.3/src/modules/standard mod_status.c
Date Thu, 03 Dec 1998 01:08:02 GMT
jim         98/12/02 17:08:02

  Modified:    src/main http_main.c
               src/modules/standard mod_status.c
  Log:
  During Graceful restarts, the value of vhostrec is bogus. To get around
  this, we reset this pointer to NULL during these.
  
  Revision  Changes    Path
  1.407     +44 -31    apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.406
  retrieving revision 1.407
  diff -u -r1.406 -r1.407
  --- http_main.c	1998/12/02 00:00:06	1.406
  +++ http_main.c	1998/12/03 01:07:54	1.407
  @@ -1531,6 +1531,12 @@
    * We begin with routines which deal with the file itself... 
    */
   
  +/* volatile just in case */
  +static int volatile shutdown_pending;
  +static int volatile restart_pending;
  +static int volatile is_graceful;
  +static int volatile generation;
  +
   #ifdef MULTITHREAD
   /*
    * In the multithreaded mode, have multiple threads - not multiple
  @@ -1542,8 +1548,14 @@
   static void reinit_scoreboard(pool *p)
   {
       ap_assert(!ap_scoreboard_image);
  -    ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE);
  -    memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
  +    if (is_graceful) {
  +        int i;
  +        for (i = 0; i < HARD_SERVER_LIMIT; i++)
  +            ap_scoreboard_image->servers[i].vhostrec = NULL;
  +    } else {
  +        ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE);
  +        memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
  +    }
   }
   
   void cleanup_scoreboard(void)
  @@ -1950,32 +1962,41 @@
   /* Called by parent process */
   static void reinit_scoreboard(pool *p)
   {
  -    int exit_gen = 0;
  -    if (ap_scoreboard_image)
  -	exit_gen = ap_scoreboard_image->global.exit_generation;
  +    if (is_graceful && ap_scoreboard_image) {
  +        int i;
  +        for (i = 0; i < HARD_SERVER_LIMIT; i++)
  +            ap_scoreboard_image->servers[i].vhostrec = NULL;
  +#ifdef SCOREBOARD_FILE
  +            force_write(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image));
  +#endif
  +    } else {
  +        int exit_gen = 0;
  +        if (ap_scoreboard_image)
  +            exit_gen = ap_scoreboard_image->global.exit_generation;
   
   #ifndef SCOREBOARD_FILE
  -    if (ap_scoreboard_image == NULL) {
  -	setup_shared_mem(p);
  -    }
  -    memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
  -    ap_scoreboard_image->global.exit_generation = exit_gen;
  +        if (ap_scoreboard_image == NULL) {
  +            setup_shared_mem(p);
  +        }
  +        memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
  +        ap_scoreboard_image->global.exit_generation = exit_gen;
   #else
  -    ap_scoreboard_image = &_scoreboard_image;
  -    ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname);
  +        ap_scoreboard_image = &_scoreboard_image;
  +        ap_scoreboard_fname = ap_server_root_relative(p, ap_scoreboard_fname);
   
  -    scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR, 0644);
  -    if (scoreboard_fd == -1) {
  -	perror(ap_scoreboard_fname);
  -	fprintf(stderr, "Cannot open scoreboard file:\n");
  -	exit(APEXIT_INIT);
  -    }
  -    ap_register_cleanup(p, NULL, cleanup_scoreboard_file, ap_null_cleanup);
  +        scoreboard_fd = ap_popenf(p, ap_scoreboard_fname, O_CREAT | O_BINARY | O_RDWR,
0644);
  +        if (scoreboard_fd == -1) {
  +            perror(ap_scoreboard_fname);
  +            fprintf(stderr, "Cannot open scoreboard file:\n");
  +            exit(APEXIT_INIT);
  +        }
  +        ap_register_cleanup(p, NULL, cleanup_scoreboard_file, ap_null_cleanup);
   
  -    memset((char *) ap_scoreboard_image, 0, sizeof(*ap_scoreboard_image));
  -    ap_scoreboard_image->global.exit_generation = exit_gen;
  -    force_write(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image));
  +        memset((char *) ap_scoreboard_image, 0, sizeof(*ap_scoreboard_image));
  +        ap_scoreboard_image->global.exit_generation = exit_gen;
  +        force_write(scoreboard_fd, ap_scoreboard_image, sizeof(*ap_scoreboard_image));
   #endif
  +    }
   }
   
   /* Routines called to deal with the scoreboard image
  @@ -2551,12 +2572,6 @@
       deferred_die = 1;
   }
   
  -/* volatile just in case */
  -static int volatile shutdown_pending;
  -static int volatile restart_pending;
  -static int volatile is_graceful;
  -static int volatile generation;
  -
   #ifdef WIN32
   /*
    * Signalling Apache on NT.
  @@ -4247,9 +4262,7 @@
   	ap_init_modules(pconf, server_conf);
   	version_locked++;	/* no more changes to server_version */
   	SAFE_ACCEPT(accept_mutex_init(pconf));
  -	if (!is_graceful) {
  -	    reinit_scoreboard(pconf);
  -	}
  +	reinit_scoreboard(pconf);
   #ifdef SCOREBOARD_FILE
   	else {
   	    ap_scoreboard_fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
  
  
  
  1.101     +2 -1      apache-1.3/src/modules/standard/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_status.c,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- mod_status.c	1998/10/28 13:02:39	1.100
  +++ mod_status.c	1998/12/03 01:08:00	1.101
  @@ -653,7 +653,8 @@
   			    ap_rprintf(r,
   			     "<td>%s<td nowrap>%s<td nowrap>%s</tr>\n\n",
   			     score_record.client,
  -			     score_record.vhostrec->server_hostname,
  +			     (score_record.vhostrec ? 
  +			      score_record.vhostrec->server_hostname : "NULL"),
   			     ap_escape_html(r->pool, score_record.request));
   		    }		/* no_table_report */
   		}			/* !short_report */
  
  
  

Mime
View raw message