Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 48364 invoked from network); 26 Sep 2004 06:56:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 26 Sep 2004 06:56:28 -0000 Received: (qmail 6310 invoked by uid 500); 26 Sep 2004 06:56:27 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 6229 invoked by uid 500); 26 Sep 2004 06:56:26 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 6216 invoked by uid 500); 26 Sep 2004 06:56:26 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Received: (qmail 6213 invoked by uid 99); 26 Sep 2004 06:56:26 -0000 X-ASF-Spam-Status: No, hits=-10.0 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 25 Sep 2004 23:56:25 -0700 Received: (qmail 48330 invoked by uid 1526); 26 Sep 2004 06:56:24 -0000 Date: 26 Sep 2004 06:56:24 -0000 Message-ID: <20040926065624.48329.qmail@minotaur.apache.org> From: mturk@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/proxy proxy_ajp.c proxy_http.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mturk 2004/09/25 23:56:24 Modified: modules/proxy proxy_ajp.c proxy_http.c Log: Count the bytes trasfered and readed so we can display the actual data traffic, and add additional balancer mechanism that will use the data traffic into account. Revision Changes Path 1.26 +8 -1 httpd-2.0/modules/proxy/proxy_ajp.c Index: proxy_ajp.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ajp.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- proxy_ajp.c 17 Sep 2004 17:02:28 -0000 1.25 +++ proxy_ajp.c 26 Sep 2004 06:56:24 -0000 1.26 @@ -118,6 +118,7 @@ const char *tenc; int havebody=1; int isok=1; + apr_off_t bb_len; /* * Send the AJP request to the remote server @@ -192,6 +193,7 @@ conn->worker->hostname); return HTTP_SERVICE_UNAVAILABLE; } + conn->worker->s->transfered += bufsiz; } } @@ -206,7 +208,6 @@ conn->worker->hostname); return HTTP_SERVICE_UNAVAILABLE; } - /* parse the reponse */ result = ajp_parse_type(r, conn->data); output_brigade = apr_brigade_create(p, r->connection->bucket_alloc); @@ -248,6 +249,7 @@ "ajp_send_data_msg failed"); break; } + conn->worker->s->transfered += bufsiz; } else { /* something is wrong TC asks for more body but we are * already at the end of the body data @@ -304,6 +306,11 @@ result = ajp_parse_type(r, conn->data); } apr_brigade_destroy(input_brigade); + + apr_brigade_length(output_brigade, 0, &bb_len); + if (bb_len != -1) + conn->worker->s->readed += bb_len; + if (!isok) apr_brigade_destroy(output_brigade); 1.200 +15 -6 httpd-2.0/modules/proxy/proxy_http.c Index: proxy_http.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v retrieving revision 1.199 retrieving revision 1.200 diff -u -r1.199 -r1.200 --- proxy_http.c 14 Sep 2004 18:54:32 -0000 1.199 +++ proxy_http.c 26 Sep 2004 06:56:24 -0000 1.200 @@ -250,6 +250,7 @@ int counter, seen_eos, send_chunks; apr_status_t status; apr_bucket_brigade *header_brigade, *body_brigade, *input_brigade; + apr_off_t transfered = 0; header_brigade = apr_brigade_create(p, origin->bucket_alloc); body_brigade = apr_brigade_create(p, origin->bucket_alloc); @@ -482,7 +483,11 @@ APR_BRIGADE_INSERT_TAIL(header_brigade, e); e = apr_bucket_flush_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(header_brigade, e); - + + apr_brigade_length(header_brigade, 0, &transfered); + if (transfered != -1) + conn->worker->s->transfered += transfered; + conn->worker->s->transfered += transfered; if (send_chunks) { status = ap_pass_brigade(origin->output_filters, header_brigade); @@ -630,9 +635,11 @@ conn->worker->cp->addr, conn->hostname); return status; } - - apr_brigade_cleanup(body_brigade); + apr_brigade_length(body_brigade, 0, &transfered); + if (transfered != -1) + conn->worker->s->transfered += transfered; + apr_brigade_cleanup(body_brigade); return APR_SUCCESS; } static void process_proxy_header(request_rec* r, proxy_server_conf* c, @@ -803,7 +810,6 @@ * response. */ rp->proxyreq = PROXYREQ_RESPONSE; - do { apr_brigade_cleanup(bb); @@ -820,6 +826,8 @@ return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server"); } + /* XXX: Is this a real headers length send from remote? */ + backend->worker->s->readed += len; /* Is it an HTTP/1 response? * This is buggy if we ever see an HTTP/1.10 @@ -1023,10 +1031,11 @@ AP_MODE_READBYTES, APR_BLOCK_READ, conf->io_buffer_size) == APR_SUCCESS) { -#if DEBUGGING - { apr_off_t readbytes; apr_brigade_length(bb, 0, &readbytes); + backend->worker->s->readed += readbytes; +#if DEBUGGING + { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy (PID %d): readbytes: %#x", getpid(), readbytes);