| 583 |
int process_slot = ti->pid; |
int process_slot = ti->pid; |
| 584 |
apr_pool_t *tpool = apr_thread_pool_get(thd); |
apr_pool_t *tpool = apr_thread_pool_get(thd); |
| 585 |
void *csd = NULL; |
void *csd = NULL; |
| 586 |
apr_pool_t *ptrans; /* Pool for per-transaction stuff */ |
apr_pool_t *ptrans = NULL; /* Pool for per-transaction stuff */ |
|
apr_pool_t *recycled_pool = NULL; |
|
| 587 |
apr_pollset_t *pollset; |
apr_pollset_t *pollset; |
| 588 |
apr_status_t rv; |
apr_status_t rv; |
| 589 |
ap_listen_rec *lr; |
ap_listen_rec *lr; |
| 623 |
if (listener_may_exit) break; |
if (listener_may_exit) break; |
| 624 |
|
|
| 625 |
if (!have_idle_worker) { |
if (!have_idle_worker) { |
| 626 |
|
/* the following pops a recycled ptrans pool off a stack |
| 627 |
|
* if there is one, in addition to reserving a worker thread |
| 628 |
|
*/ |
| 629 |
rv = ap_queue_info_wait_for_idler(worker_queue_info, |
rv = ap_queue_info_wait_for_idler(worker_queue_info, |
| 630 |
&recycled_pool); |
&ptrans); |
| 631 |
if (APR_STATUS_IS_EOF(rv)) { |
if (APR_STATUS_IS_EOF(rv)) { |
| 632 |
break; /* we've been signaled to die now */ |
break; /* we've been signaled to die now */ |
| 633 |
} |
} |
| 715 |
} /* if/else */ |
} /* if/else */ |
| 716 |
|
|
| 717 |
if (!listener_may_exit) { |
if (!listener_may_exit) { |
| 718 |
/* create a new transaction pool for each accepted socket */ |
if (ptrans == NULL) { |
| 719 |
if (recycled_pool == NULL) { |
/* we can't use a recycled transaction pool this time. |
| 720 |
|
* create a new transaction pool */ |
| 721 |
apr_allocator_t *allocator; |
apr_allocator_t *allocator; |
| 722 |
|
|
| 723 |
apr_allocator_create(&allocator); |
apr_allocator_create(&allocator); |
| 725 |
apr_pool_create_ex(&ptrans, pconf, NULL, allocator); |
apr_pool_create_ex(&ptrans, pconf, NULL, allocator); |
| 726 |
apr_allocator_owner_set(allocator, ptrans); |
apr_allocator_owner_set(allocator, ptrans); |
| 727 |
} |
} |
|
else { |
|
|
ptrans = recycled_pool; |
|
|
recycled_pool = NULL; |
|
|
} |
|
| 728 |
apr_pool_tag(ptrans, "transaction"); |
apr_pool_tag(ptrans, "transaction"); |
| 729 |
rv = lr->accept_func(&csd, lr, ptrans); |
rv = lr->accept_func(&csd, lr, ptrans); |
| 730 |
/* later we trash rv and rely on csd to indicate success/failure */ |
/* later we trash rv and rely on csd to indicate success/failure */ |
| 760 |
apr_socket_close(csd); |
apr_socket_close(csd); |
| 761 |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, |
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, ap_server_conf, |
| 762 |
"ap_queue_push failed"); |
"ap_queue_push failed"); |
|
recycled_pool = ptrans; |
|
| 763 |
} |
} |
| 764 |
else { |
else { |
| 765 |
have_idle_worker = 0; |
have_idle_worker = 0; |
| 766 |
} |
} |
| 767 |
} |
} |
|
else { |
|
|
recycled_pool = ptrans; |
|
|
} |
|
| 768 |
} |
} |
| 769 |
else { |
else { |
| 770 |
if ((rv = SAFE_ACCEPT(apr_proc_mutex_unlock(accept_mutex))) |
if ((rv = SAFE_ACCEPT(apr_proc_mutex_unlock(accept_mutex))) |