status WRITE (meaning 'in the request processing
phase' even if still consuming the request body,
not literally in a 'now writing' state).
Ensure a number of MPMs and the h2 connection io
no longer clobber the request status line during
state-only changes. While at it, clean up some
very ugly formatting and unnecessary decoration,
and avoid the wordy _from_conn() flavor when we
are not passing a connection_rec.
Ensure the useragent_ip is only used in the case
where it has been initialized, fall back on the
connection's remote_ip if the status is accidently
updated from an uninitialized request_rec.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@
1741310 13f79535-47bb-0310-9956-
ffa450edef68
return APR_SUCCESS;
}
- ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_WRITE, c);
+ ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, NULL);
apr_brigade_length(bb, 0, &bblen);
h2_conn_io_bb_log(c, 0, APLOG_TRACE2, "master conn pass", bb);
status = ap_pass_brigade(c->output_filters, bb);
"h2_task(%s): create request_rec", task->id);
r = h2_request_create_rec(req, c);
if (r && (r->status == HTTP_OK)) {
- ap_update_child_status(c->sbh, SERVER_BUSY_READ, r);
+ ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, r);
if (cs) {
cs->state = CONN_STATE_HANDLER;
core_server_config *sconf = ap_get_core_module_config(s->module_config);
c->sbh = sbh;
- (void)ap_update_child_status(c->sbh, SERVER_BUSY_READ, (request_rec *)NULL);
+ ap_update_child_status(c->sbh, SERVER_BUSY_READ, NULL);
/* Got a connection structure, so initialize what fields we can
* (the rest are zeroed out by pcalloc).
if (cs->pub.state == CONN_STATE_WRITE_COMPLETION) {
int not_complete_yet;
- ap_update_child_status_from_conn(sbh, SERVER_BUSY_WRITE, c);
+ ap_update_child_status(sbh, SERVER_BUSY_WRITE, NULL);
not_complete_yet = ap_run_output_pending(c);
start_lingering_close_blocking(cs);
}
else if (cs->pub.state == CONN_STATE_CHECK_REQUEST_LINE_READABLE) {
- ap_update_child_status_from_conn(sbh, SERVER_BUSY_KEEPALIVE, c);
+ ap_update_child_status(sbh, SERVER_BUSY_KEEPALIVE, NULL);
/* It greatly simplifies the logic to use a single timeout value per q
* because the new element can just be added to the end of the list and
}
ap_update_child_status_from_indexes(process_slot, thread_slot,
- dying ? SERVER_GRACEFUL : SERVER_READY, NULL);
+ dying ? SERVER_GRACEFUL
+ : SERVER_READY, NULL);
worker_pop:
if (workers_may_exit) {
break;
}
ap_update_child_status_from_indexes(process_slot, thread_slot,
- dying ? SERVER_DEAD :
- SERVER_GRACEFUL,
- (request_rec *) NULL);
+ dying ? SERVER_DEAD
+ : SERVER_GRACEFUL, NULL);
apr_thread_exit(thd, APR_SUCCESS);
return NULL;
for (i = 0; i < threads_per_child; i++)
ap_update_child_status_from_indexes(child_slot, i,
- SERVER_DEAD,
- (request_rec *) NULL);
+ SERVER_DEAD, NULL);
event_note_child_killed(child_slot, 0, 0);
ps = &ap_scoreboard_image->parent[child_slot];
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, APLOGNO(03331)
"motorz_io_process(): CONN_STATE_WRITE_COMPLETION");
- ap_update_child_status_from_conn(scon->sbh, SERVER_BUSY_WRITE, c);
+ ap_update_child_status(scon->sbh, SERVER_BUSY_WRITE, NULL);
not_complete_yet = ap_run_output_pending(c);
ap_create_sb_handle(&sbh, pchild, my_child_num, 0);
- (void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
+ ap_update_child_status(sbh, SERVER_READY, NULL);
apr_skiplist_init(&mz->timeout_ring, mz->pool);
apr_skiplist_set_compare(mz->timeout_ring, timer_comp, timer_comp);
clean_child_exit(0);
}
- (void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
+ ap_update_child_status(sbh, SERVER_READY, NULL);
{
apr_time_t tnow = apr_time_now();
motorz_timer_t *te;
return -1;
}
- (void) ap_update_child_status_from_indexes(slot, 0, SERVER_STARTING,
- (request_rec *) NULL);
+ ap_update_child_status_from_indexes(slot, 0, SERVER_STARTING, NULL);
if ((pid = fork()) == -1) {
ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, APLOGNO(02872) "fork: Unable to fork new process");
/* fork didn't succeed. Fix the scoreboard or else
* it will say SERVER_STARTING forever and ever
*/
- (void) ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD,
- (request_rec *) NULL);
+ ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD, NULL);
/* In case system resources are maxxed out, we don't want
* Apache running away with the CPU trying to fork over and
/* non-fatal death... note that it's gone in the scoreboard. */
if (child_slot >= 0) {
- (void) ap_update_child_status_from_indexes(child_slot, 0, SERVER_DEAD,
- (request_rec *) NULL);
+ ap_update_child_status_from_indexes(child_slot, 0,
+ SERVER_DEAD, NULL);
motorz_note_child_killed(child_slot, 0, 0);
if (remaining_children_to_start
&& child_slot < ap_num_kids) {
if (scon->cs.state == CONN_STATE_WRITE_COMPLETION) {
int not_complete_yet;
- ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_WRITE, c);
+ ap_update_child_status(c->sbh, SERVER_BUSY_WRITE, NULL);
not_complete_yet = ap_run_output_pending(c);
if (not_complete_yet > OK) {
}
}
- ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD,
- (request_rec *) NULL);
+ ap_update_child_status_from_indexes(0, thread_num, SERVER_DEAD, NULL);
return 0;
}
threads_created);
}
for (i = 0; i < threads_created; i++) {
- int *score_idx;
+ int *idx;
TerminateThread(child_handles[i], 1);
CloseHandle(child_handles[i]);
/* Reset the scoreboard entry for the thread we just whacked */
- score_idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
- if (score_idx) {
- ap_update_child_status_from_indexes(0, *score_idx, SERVER_DEAD, NULL);
+ idx = apr_hash_get(ht, &child_handles[i], sizeof(HANDLE));
+ if (idx) {
+ ap_update_child_status_from_indexes(0, *idx, SERVER_DEAD, NULL);
}
}
ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, APLOGNO(00364)
ap_scoreboard_image->servers[process_slot][thread_slot].pid = ap_my_pid;
ap_scoreboard_image->servers[process_slot][thread_slot].tid = apr_os_thread_current();
ap_scoreboard_image->servers[process_slot][thread_slot].generation = retained->my_generation;
- ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_STARTING, NULL);
+ ap_update_child_status_from_indexes(process_slot, thread_slot,
+ SERVER_STARTING, NULL);
#ifdef HAVE_PTHREAD_KILL
unblock_signal(WORKER_SIGNAL);
is_idle = 1;
}
- ap_update_child_status_from_indexes(process_slot, thread_slot, SERVER_READY, NULL);
+ ap_update_child_status_from_indexes(process_slot, thread_slot,
+ SERVER_READY, NULL);
worker_pop:
if (workers_may_exit) {
break;
}
ap_update_child_status_from_indexes(process_slot, thread_slot,
- (dying) ? SERVER_DEAD : SERVER_GRACEFUL, (request_rec *) NULL);
+ dying ? SERVER_DEAD
+ : SERVER_GRACEFUL, NULL);
apr_thread_exit(thd, APR_SUCCESS);
return NULL;
process_score *ps;
for (i = 0; i < threads_per_child; i++)
- ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD,
- (request_rec *) NULL);
+ ap_update_child_status_from_indexes(child_slot, i,
+ SERVER_DEAD, NULL);
worker_note_child_killed(child_slot, 0, 0);
ps = &ap_scoreboard_image->parent[child_slot];
copy_request(ws->request, sizeof(ws->request), r);
}
- if (r) {
+ if (r && r->useragent_ip) {
if (!(val = ap_get_useragent_host(r, REMOTE_NOLOOKUP, NULL)))
apr_cpystrn(ws->client, r->useragent_ip, sizeof(ws->client));
else