MCPcopy Create free account
hub / github.com/apache/httpd / hc_check

Function hc_check

modules/proxy/mod_proxy_hcheck.c:921–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

919}
920
921static void * APR_THREAD_FUNC hc_check(apr_thread_t *thread, void *b)
922{
923 baton_t *baton = (baton_t *)b;
924 server_rec *s = baton->ctx->s;
925 proxy_worker *worker = baton->worker;
926 proxy_worker *hc = baton->hc;
927 apr_time_t now;
928 apr_status_t rv;
929
930 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03256)
931 "%sHealth checking %s", (thread ? "Threaded " : ""),
932 worker->s->name_ex);
933
934 if (hc->s->method == TCP) {
935 rv = hc_check_tcp(baton);
936 }
937 else if (hc->s->method == CPING) {
938 rv = hc_check_cping(baton, thread);
939 }
940 else {
941 rv = hc_check_http(baton, thread);
942 }
943
944 now = apr_time_now();
945 if (rv == APR_ENOTIMPL) {
946 ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(03257)
947 "Somehow tried to use unimplemented hcheck method: %d",
948 (int)hc->s->method);
949 }
950 /* what state are we in ? */
951 else if (PROXY_WORKER_IS_HCFAILED(worker) || PROXY_WORKER_IS_ERROR(worker)) {
952 if (rv == APR_SUCCESS) {
953 worker->s->pcount += 1;
954 if (worker->s->pcount >= worker->s->passes) {
955 ap_proxy_set_wstatus(PROXY_WORKER_HC_FAIL_FLAG, 0, worker);
956 ap_proxy_set_wstatus(PROXY_WORKER_IN_ERROR_FLAG, 0, worker);
957 worker->s->pcount = 0;
958 ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO(03302)
959 "%sHealth check ENABLING %s", (thread ? "Threaded " : ""),
960 worker->s->name_ex);
961
962 }
963 }
964 }
965 else {
966 if (rv != APR_SUCCESS) {
967 worker->s->error_time = now;
968 worker->s->fcount += 1;
969 if (worker->s->fcount >= worker->s->fails) {
970 ap_proxy_set_wstatus(PROXY_WORKER_HC_FAIL_FLAG, 1, worker);
971 worker->s->fcount = 0;
972 ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO(03303)
973 "%sHealth check DISABLING %s", (thread ? "Threaded " : ""),
974 worker->s->name_ex);
975 }
976 }
977 }
978 if (baton->now) {

Callers 1

hc_watchdog_callbackFunction · 0.85

Calls 5

hc_check_tcpFunction · 0.85
hc_check_cpingFunction · 0.85
hc_check_httpFunction · 0.85
ap_proxy_set_wstatusFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected