From: Ryan Bloom Date: Tue, 1 Aug 2000 20:25:56 +0000 (+0000) Subject: This serves requests again, although it still doesn't forward requests off X-Git-Tag: APACHE_2_0_ALPHA_5~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78e0d959b34b51e2a203afc1bb8d5edb8d7b49bd;p=apache This serves requests again, although it still doesn't forward requests off to the correct socket yet. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85972 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index a80df25936..32c1a4d513 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -557,8 +557,9 @@ static void *worker_thread(void *arg) ap_create_pool(&ptrans, tpool); ap_setup_poll(&pollset, num_listenfds+1, tpool); - for(n=0 ; n <= num_listenfds ; ++n) + for(n=0 ; n <= num_listenfds ; ++n) { ap_add_poll_socket(pollset, listenfds[n], APR_POLLIN); + } while (!workers_may_exit) { workers_may_exit |= (max_requests_per_child != 0) && (requests_this_child <= 0); @@ -833,7 +834,6 @@ static void child_main(int child_num_arg) int i; ap_listen_rec *lr; ap_status_t rv; - int sd; my_pid = getpid(); child_num = child_num_arg; @@ -883,8 +883,10 @@ static void child_main(int child_num_arg) #if APR_FILES_AS_SOCKETS ap_socket_from_file(&listenfds[0], pipe_of_death_in); #endif + /* The child socket */ - ap_put_os_sock(&listenfds[1], &sd, pchild); + ap_put_os_sock(&listenfds[1], &child_info_table[child_num].sd, pchild); + num_listenfds++; for (lr = ap_listeners, i = 2; i <= num_listenfds; lr = lr->next, ++i) listenfds[i]=lr->sd; @@ -1394,17 +1396,19 @@ static int perchild_post_read(request_rec *r) int num; fprintf(stderr, "In perchild_post_read\n"); + fflush(stderr); process_num = ap_hash_get(socket_info_table, hostname, 0); if (process_num) { num = atoi(process_num); } else { - num = -1; + num = socket_num; } - if (num != child_num) { + if (num != child_info_table[child_num].num) { /* package the request and send it to another child */ -fprintf(stderr, "leaving DECLINED\n"); +fprintf(stderr, "leaving DECLINED %d %d\n", num, child_num); + fflush(stderr); return DECLINED; } return OK; diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index a80df25936..32c1a4d513 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -557,8 +557,9 @@ static void *worker_thread(void *arg) ap_create_pool(&ptrans, tpool); ap_setup_poll(&pollset, num_listenfds+1, tpool); - for(n=0 ; n <= num_listenfds ; ++n) + for(n=0 ; n <= num_listenfds ; ++n) { ap_add_poll_socket(pollset, listenfds[n], APR_POLLIN); + } while (!workers_may_exit) { workers_may_exit |= (max_requests_per_child != 0) && (requests_this_child <= 0); @@ -833,7 +834,6 @@ static void child_main(int child_num_arg) int i; ap_listen_rec *lr; ap_status_t rv; - int sd; my_pid = getpid(); child_num = child_num_arg; @@ -883,8 +883,10 @@ static void child_main(int child_num_arg) #if APR_FILES_AS_SOCKETS ap_socket_from_file(&listenfds[0], pipe_of_death_in); #endif + /* The child socket */ - ap_put_os_sock(&listenfds[1], &sd, pchild); + ap_put_os_sock(&listenfds[1], &child_info_table[child_num].sd, pchild); + num_listenfds++; for (lr = ap_listeners, i = 2; i <= num_listenfds; lr = lr->next, ++i) listenfds[i]=lr->sd; @@ -1394,17 +1396,19 @@ static int perchild_post_read(request_rec *r) int num; fprintf(stderr, "In perchild_post_read\n"); + fflush(stderr); process_num = ap_hash_get(socket_info_table, hostname, 0); if (process_num) { num = atoi(process_num); } else { - num = -1; + num = socket_num; } - if (num != child_num) { + if (num != child_info_table[child_num].num) { /* package the request and send it to another child */ -fprintf(stderr, "leaving DECLINED\n"); +fprintf(stderr, "leaving DECLINED %d %d\n", num, child_num); + fflush(stderr); return DECLINED; } return OK;