httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r821418 - /httpd/httpd/trunk/server/scoreboard.c
Date Sat, 03 Oct 2009 21:20:42 GMT
Author: trawick
Date: Sat Oct  3 21:20:40 2009
New Revision: 821418

URL: http://svn.apache.org/viewvc?rev=821418&view=rev
Log:
refactor child status update functions to accommodate the addition of
ap_update_child_status_from_conn()

Reviewed by: rpluem

Modified:
    httpd/httpd/trunk/server/scoreboard.c

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=821418&r1=821417&r2=821418&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Sat Oct  3 21:20:40 2009
@@ -427,20 +427,17 @@
     }
 }
 
-AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
-                                                    int thread_num,
-                                                    int status,
-                                                    request_rec *r)
+static int update_child_status_internal(int child_num,
+                                        int thread_num,
+                                        int status,
+                                        conn_rec *c,
+                                        request_rec *r)
 {
     int old_status;
     worker_score *ws;
     process_score *ps;
     int mpm_generation;
 
-    if (child_num < 0) {
-        return -1;
-    }
-
     ws = &ap_scoreboard_image->servers[child_num][thread_num];
     old_status = ws->status;
     ws->status = status;
@@ -468,7 +465,6 @@
             ws->conn_bytes = 0;
         }
         if (r) {
-            conn_rec *c = r->connection;
             apr_cpystrn(ws->client, ap_get_remote_host(c, r->per_dir_config,
                         REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
             copy_request(ws->request, sizeof(ws->request), r);
@@ -477,19 +473,39 @@
                             sizeof(ws->vhost));
             }
         }
+        else if (c) {
+            apr_cpystrn(ws->client, ap_get_remote_host(c, NULL,
+                        REMOTE_NOLOOKUP, NULL), sizeof(ws->client));
+        }
     }
 
     return old_status;
 }
 
+AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
+                                                    int thread_num,
+                                                    int status,
+                                                    request_rec *r)
+{
+    if (child_num < 0) {
+        return -1;
+    }
+
+    return update_child_status_internal(child_num, thread_num, status,
+                                        r ? r->connection : NULL,
+                                        r);
+}
+
 AP_DECLARE(int) ap_update_child_status(ap_sb_handle_t *sbh, int status,
                                       request_rec *r)
 {
     if (!sbh)
         return -1;
 
-    return ap_update_child_status_from_indexes(sbh->child_num, sbh->thread_num,
-                                               status, r);
+    return update_child_status_internal(sbh->child_num, sbh->thread_num,
+                                        status,
+                                        r ? r->connection : NULL,
+                                        r);
 }
 
 AP_DECLARE(int) ap_update_child_status_from_conn(ap_sb_handle_t *sbh, int status,
@@ -498,11 +514,8 @@
     if (!sbh)
         return -1;
     
-    request_rec fake_rec;
-    fake_rec.connection = c;
-            
-    return ap_update_child_status_from_indexes(sbh->child_num, sbh->thread_num,
-                                               status, &fake_rec);
+    return update_child_status_internal(sbh->child_num, sbh->thread_num,
+                                        status, c, NULL);
 }
 
 AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status)



Mime
View raw message