Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 40605 invoked from network); 23 Jan 2006 15:57:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jan 2006 15:57:28 -0000 Received: (qmail 74396 invoked by uid 500); 23 Jan 2006 15:57:27 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 74358 invoked by uid 500); 23 Jan 2006 15:57: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: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 74347 invoked by uid 99); 23 Jan 2006 15:57:26 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2006 07:57:26 -0800 X-ASF-Spam-Status: No, hits=-9.4 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.29) with SMTP; Mon, 23 Jan 2006 07:57:25 -0800 Received: (qmail 40476 invoked by uid 65534); 23 Jan 2006 15:57:05 -0000 Message-ID: <20060123155705.40475.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r371560 - /httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c Date: Mon, 23 Jan 2006 15:57:04 -0000 To: cvs@httpd.apache.org From: rooneg@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rooneg Date: Mon Jan 23 07:57:03 2006 New Revision: 371560 URL: http://svn.apache.org/viewcvs?rev=371560&view=rev Log: Update the proxy worker stats when we read/write data from/to the back end fastcgi process. * modules/proxy/mod_proxy_fcgi.c (send_data, get_data): New wrapper functions that do the sendv/recv stuff and then update the proper statistics. (send_begin_request, send_environment, dispatch): Use send_data/get_data. Modified: httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c Modified: httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c?rev=371560&r1=371559&r2=371560&view=diff ============================================================================== --- httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c (original) +++ httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c Mon Jan 23 07:57:03 2006 @@ -142,6 +142,35 @@ header->reserved = 0; } +/* Wrapper for apr_socket_sendv that handles updating the worker stats. */ +static apr_status_t send_data(proxy_conn_rec *conn, + struct iovec *vec, + int nvec, + apr_size_t *len) +{ + apr_status_t rv = apr_socket_sendv(conn->sock, vec, nvec, len); + + if (! rv) { + conn->worker->s->transferred += *len; + } + + return rv; +} + +/* Wrapper for apr_socket_recv that handles updating the worker stats. */ +static apr_status_t get_data(proxy_conn_rec *conn, + char *buffer, + apr_size_t *buflen) +{ + apr_status_t rv = apr_socket_recv(conn->sock, buffer, buflen); + + if (! rv) { + conn->worker->s->read += *buflen; + } + + return rv; +} + static apr_status_t send_begin_request(proxy_conn_rec *conn, int request_id) { struct iovec vec[2]; @@ -165,7 +194,7 @@ vec[1].iov_base = abrb; vec[1].iov_len = sizeof(abrb); - return apr_socket_sendv(conn->sock, vec, 2, &len); + return send_data(conn, vec, 2, &len); } static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r, @@ -284,7 +313,7 @@ vec[1].iov_base = body; vec[1].iov_len = bodylen; - rv = apr_socket_sendv(conn->sock, vec, 2, &len); + rv = send_data(conn, vec, 2, &len); if (rv) { return rv; } @@ -295,7 +324,7 @@ vec[0].iov_base = farray; vec[0].iov_len = sizeof(farray); - return apr_socket_sendv(conn->sock, vec, 1, &len); + return send_data(conn, vec, 1, &len); } enum { @@ -529,14 +558,11 @@ /* XXX This should be nonblocking, and if we don't write all * the data we need to keep track of that fact so we can * get to it next time through. */ - rv = apr_socket_sendv(conn->sock, vec, 2, &len); + rv = send_data(conn, vec, 2, &len); if (rv != APR_SUCCESS) { break; } - /* XXX AJP updates conn->worker->s->transferred here, do we need - * to? */ - if (last_stdin) { pfd.reqevents = APR_POLLIN; /* Done with input data */ @@ -546,7 +572,7 @@ vec[0].iov_base = farray; vec[0].iov_len = sizeof(farray); - rv = apr_socket_sendv(conn->sock, vec, 1, &len); + rv = send_data(conn, vec, 1, &len); } } @@ -567,7 +593,7 @@ /* First, we grab the header... */ readbuflen = FCGI_HEADER_LEN; - rv = apr_socket_recv(conn->sock, (char *) farray, &readbuflen); + rv = get_data(conn, (char *) farray, &readbuflen); if (rv != APR_SUCCESS) { break; } @@ -622,7 +648,7 @@ * recv call, this will eventually change when we move to real * nonblocking recv calls. */ if (readbuflen != 0) { - rv = apr_socket_recv(conn->sock, readbuf, &readbuflen); + rv = get_data(conn, readbuf, &readbuflen); if (rv != APR_SUCCESS) { break; } @@ -650,8 +676,6 @@ } } - /* XXX Update conn->worker->s->read like AJP does */ - if (seen_end_of_headers) { rv = ap_pass_brigade(r->output_filters, ob); if (rv != APR_SUCCESS) { @@ -713,7 +737,7 @@ if (plen) { readbuflen = plen; - rv = apr_socket_recv(conn->sock, readbuf, &readbuflen); + rv = get_data(conn, readbuf, &readbuflen); if (rv != APR_SUCCESS) { break; }