rbb 99/02/17 10:42:03
Modified: pthreads/src/main http_main.c Log: This patch fixes a few different things. The first, is that if MaxRequestsPerChild was set to 0 in the config file, the child would start and stop immediately. This fixes that. The rest are mostly syntax errors that my compiler didn't catch before. Revision Changes Path 1.41 +8 -15 apache-apr/pthreads/src/main/http_main.c Index: http_main.c =================================================================== RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- http_main.c 1999/02/17 16:28:03 1.40 +++ http_main.c 1999/02/17 18:42:01 1.41 @@ -1521,7 +1521,7 @@ static void graceful_sig_handler(int sig) { requests_this_child = 0; - fprintf(stderr, "SigWINCH received in child\n"); + ap_max_requests_per_child = 1; } /***************************************************************** @@ -2173,13 +2173,6 @@ * Child process main loop. */ -API_EXPORT(void) ap_child_terminate(request_rec *r) -{ - r->connection->keepalive = 0; - /* requests_this_child = ap_max_requests_per_child = 1; */ - /* ZZZ doesn't really make sense in a threaded server. */ -} - static void process_socket(pool *p, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) { struct sockaddr sa_server; /* ZZZZ */ @@ -2276,7 +2269,8 @@ sock_disable_nagle(sd); */ - while (0 < requests_this_child) { + while ((ap_max_requests_per_child != 0 && ++requests_this_child > 0) || + (ap_max_requests_per_child == 0)) { (void) ap_update_child_status(my_pid, my_tid, SERVER_ACCEPTING, (request_rec *) NULL); /* lock around the accept if necessary */ @@ -2298,10 +2292,9 @@ if (exiting_now == 0) { exiting_now++; pthread_mutex_unlock(exit_mutex); - graceful_killer; + graceful_killer(); clean_child_exit(0); } -fprintf(stderr,"thorugh pthread_once\n"); pthread_exit(NULL); } @@ -2317,7 +2310,8 @@ free(ti); ptrans = ap_make_sub_pool(pchild); - while (0 < requests_this_child) { + while ((ap_max_requests_per_child != 0 && ++requests_this_child > 0) || + (ap_max_requests_per_child == 0)) { (void) ap_update_child_status(my_pid, my_tid, SERVER_READY, (request_rec *) NULL); @@ -2333,10 +2327,9 @@ if (exiting_now == 0) { exiting_now++; pthread_mutex_unlock(exit_mutex); - graceful_killer; + graceful_killer(); clean_child_exit(0); } - fprintf(stderr,"through with pthread_once worker\n"); pthread_exit(NULL); } @@ -2819,7 +2812,7 @@ pid = wait_or_timeout(&status); if (pid >= 0) { - child_slot = find_child_by_pid(0); + child_slot = find_child_by_pid(pid); if (child_slot >= 0) { /* (void) ap_update_child_status(child_slot, SERVER_DEAD, (request_rec *) NULL);