| 617 | } |
| 618 | |
| 619 | static apr_status_t hc_init_baton(baton_t *baton) |
| 620 | { |
| 621 | sctx_t *ctx = baton->ctx; |
| 622 | proxy_worker *worker = baton->worker, *hc; |
| 623 | apr_status_t rv = APR_SUCCESS; |
| 624 | int once = 0; |
| 625 | |
| 626 | /* |
| 627 | * Since this is the watchdog, workers never actually handle a |
| 628 | * request here, and so the local data isn't initialized (of |
| 629 | * course, the shared memory is). So we need to bootstrap |
| 630 | * worker->cp. Note, we only need do this once. |
| 631 | */ |
| 632 | if (!worker->cp) { |
| 633 | rv = ap_proxy_initialize_worker(worker, ctx->s, ctx->p); |
| 634 | if (rv != APR_SUCCESS) { |
| 635 | ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ctx->s, APLOGNO(03250) "Cannot init worker"); |
| 636 | return rv; |
| 637 | } |
| 638 | once = 1; |
| 639 | } |
| 640 | |
| 641 | baton->hc = hc = hc_get_hcworker(ctx, worker, baton->ptemp); |
| 642 | |
| 643 | /* Try to resolve the worker address once if it's reusable */ |
| 644 | if (once && worker->s->is_address_reusable) { |
| 645 | proxy_conn_rec *backend = NULL; |
| 646 | if (hc_get_backend("HCHECK", &backend, hc, ctx)) { |
| 647 | rv = APR_EGENERAL; |
| 648 | } |
| 649 | if (backend) { |
| 650 | backend->close = 1; |
| 651 | ap_proxy_release_connection("HCHECK", backend, ctx->s); |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | return rv; |
| 656 | } |
| 657 | |
| 658 | static apr_status_t hc_check_cping(baton_t *baton, apr_thread_t *thread) |
| 659 | { |
no test coverage detected