summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJeff Trawick <trawick@apache.org>2009-10-03 23:20:40 +0200
committerJeff Trawick <trawick@apache.org>2009-10-03 23:20:40 +0200
commita09941bcffc83607e988336f84548911db237c0d (patch)
tree3fbab1ff7e1587b16407092a06363aa4b5ad3929 /server
parentUpdate transformations. (diff)
downloadapache2-a09941bcffc83607e988336f84548911db237c0d.tar.xz
apache2-a09941bcffc83607e988336f84548911db237c0d.zip
refactor child status update functions to accommodate the addition of
ap_update_child_status_from_conn() Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@821418 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--server/scoreboard.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/server/scoreboard.c b/server/scoreboard.c
index f5423a8ed0..a1a3dbb7db 100644
--- a/server/scoreboard.c
+++ b/server/scoreboard.c
@@ -427,20 +427,17 @@ static void copy_request(char *rbuf, apr_size_t rbuflen, request_rec *r)
}
}
-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 @@ AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
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 @@ AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num,
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 @@ AP_DECLARE(int) ap_update_child_status_from_conn(ap_sb_handle_t *sbh, int status
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)