You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Randy Terbush <ra...@zyzzyva.com> on 1997/03/18 03:02:44 UTC
Re: [PATCH] Fix per-connection counter in server status
+1
> I discovered this bug while testing my header changes.
>
> ....Roy
>
> Index: http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apache/src/http_main.c,v
> retrieving revision 1.129
> diff -c -r1.129 http_main.c
> *** http_main.c 1997/03/15 20:49:09 1.129
> --- http_main.c 1997/03/16 06:09:55
> ***************
> *** 866,877 ****
>
> #if defined(STATUS)
> new_score_rec.last_used=time(NULL);
> ! if (status == SERVER_DEAD) {
> /*
> * Reset individual counters
> */
> ! new_score_rec.my_access_count = 0L;
> ! new_score_rec.my_bytes_served = 0L;
> new_score_rec.conn_count = (unsigned short)0;
> new_score_rec.conn_bytes = (unsigned long)0;
> }
> --- 866,879 ----
>
> #if defined(STATUS)
> new_score_rec.last_used=time(NULL);
> ! if (status == SERVER_READY || status == SERVER_DEAD) {
> /*
> * Reset individual counters
> */
> ! if (status == SERVER_DEAD) {
> ! new_score_rec.my_access_count = 0L;
> ! new_score_rec.my_bytes_served = 0L;
> ! }
> new_score_rec.conn_count = (unsigned short)0;
> new_score_rec.conn_bytes = (unsigned long)0;
> }
> ***************
> *** 952,958 ****
> }
>
> #if defined(STATUS)
> ! void increment_counts (int child_num, request_rec *r, int flag)
> {
> long int bs=0;
> short_score new_score_rec;
> --- 954,960 ----
> }
>
> #if defined(STATUS)
> ! static void increment_counts (int child_num, request_rec *r)
> {
> long int bs=0;
> short_score new_score_rec;
> ***************
> *** 962,971 ****
> if (r->sent_bodyct)
> bgetopt(r->connection->client, BO_BYTECT, &bs);
>
> - if (flag) {
> - new_score_rec.conn_count = (unsigned short)0;
> - new_score_rec.conn_bytes = (unsigned long)0;
> - }
> new_score_rec.access_count ++;
> new_score_rec.my_access_count ++;
> new_score_rec.conn_count ++;
> --- 964,969 ----
> ***************
> *** 1765,1771 ****
>
> if (r) process_request(r); /* else premature EOF --- ignore */
> #if defined(STATUS)
> ! if (r) increment_counts(child_num,r,1);
> #endif
> if (!r || !current_conn->keepalive)
> break;
> --- 1763,1769 ----
>
> if (r) process_request(r); /* else premature EOF --- ignore */
> #if defined(STATUS)
> ! if (r) increment_counts(child_num, r);
> #endif
> if (!r || !current_conn->keepalive)
> break;