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

Function hc_check_cping

modules/proxy/mod_proxy_hcheck.c:658–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658static apr_status_t hc_check_cping(baton_t *baton, apr_thread_t *thread)
659{
660 int status;
661 sctx_t *ctx = baton->ctx;
662 proxy_worker *hc = baton->hc;
663 proxy_conn_rec *backend = NULL;
664 apr_pool_t *ptemp = baton->ptemp;
665 request_rec *r;
666 apr_interval_time_t timeout;
667
668 if (!ajp_handle_cping_cpong) {
669 return APR_ENOTIMPL;
670 }
671
672 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, baton->ctx->s, "HCCPING starting");
673 if ((status = hc_get_backend("HCCPING", &backend, hc, ctx)) != OK) {
674 return backend_cleanup("HCCPING", backend, ctx->s, status);
675 }
676 if ((status = ap_proxy_connect_backend("HCCPING", backend, hc, ctx->s)) != OK) {
677 return backend_cleanup("HCCPING", backend, ctx->s, status);
678 }
679 r = create_request_rec(ptemp, ctx->s, baton->balancer, "CPING", NULL);
680 if ((status = ap_proxy_connection_create_ex("HCCPING", backend, r)) != OK) {
681 return backend_cleanup("HCCPING", backend, ctx->s, status);
682 }
683 set_request_connection(r, backend->connection);
684 backend->connection->current_thread = thread;
685
686 if (hc->s->ping_timeout_set) {
687 timeout = hc->s->ping_timeout;
688 } else if ( hc->s->conn_timeout_set) {
689 timeout = hc->s->conn_timeout;
690 } else if ( hc->s->timeout_set) {
691 timeout = hc->s->timeout;
692 } else {
693 /* default to socket timeout */
694 apr_socket_timeout_get(backend->sock, &timeout);
695 }
696 status = ajp_handle_cping_cpong(backend->sock, r, timeout);
697 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, baton->ctx->s, "HCCPING done %d", status);
698 return backend_cleanup("HCCPING", backend, ctx->s, status);
699}
700
701static apr_status_t hc_check_tcp(baton_t *baton)
702{

Callers 1

hc_checkFunction · 0.85

Calls 8

hc_get_backendFunction · 0.85
backend_cleanupFunction · 0.85
ap_proxy_connect_backendFunction · 0.85
create_request_recFunction · 0.85
set_request_connectionFunction · 0.85
ajp_handle_cping_cpongFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected