httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r371560 - /httpd/httpd/branches/fcgi-proxy-dev/modules/proxy/mod_proxy_fcgi.c
Date Mon, 23 Jan 2006 15:57:04 GMT
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;
                 }



Mime
View raw message