MCPcopy Create free account
hub / github.com/apache/trafficserver / mark_host_failure

Method mark_host_failure

src/proxy/http/HttpSM.cc:5875–5907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5873}
5874
5875void
5876HttpSM::mark_host_failure(ResolveInfo *info, ts_time time_down)
5877{
5878 char addrbuf[INET6_ADDRPORTSTRLEN];
5879
5880 if (info->active) {
5881 if (time_down != TS_TIME_ZERO) {
5882 ats_ip_nptop(&t_state.current.server->dst_addr.sa, addrbuf, sizeof(addrbuf));
5883 // Increment the fail_count
5884 if (auto [down, fail_count] = info->active->increment_fail_count(time_down, t_state.txn_conf->connect_attempts_rr_retries);
5885 down) {
5886 char *url_str = t_state.hdr_info.client_request.url_string_get_ref(nullptr);
5887 int host_len;
5888 const char *host_name_ptr = t_state.unmapped_url.host_get(&host_len);
5889 std::string_view host_name{host_name_ptr, static_cast<size_t>(host_len)};
5890 swoc::bwprint(error_bw_buffer, "CONNECT : {::s} connecting to {} for host='{}' url='{}' fail_count='{}' marking down",
5891 swoc::bwf::Errno(t_state.current.server->connect_result), t_state.current.server->dst_addr, host_name,
5892 swoc::bwf::FirstOf(url_str, "<none>"), fail_count);
5893 Log::error("%s", error_bw_buffer.c_str());
5894 SMDbg(dbg_ctl_http, "hostdb update marking IP: %s as down", addrbuf);
5895 ATS_PROBE2(hostdb_mark_ip_as_down, sm_id, addrbuf);
5896 } else {
5897 ATS_PROBE3(hostdb_inc_ip_failcount, sm_id, addrbuf, fail_count);
5898 SMDbg(dbg_ctl_http, "hostdb increment IP failcount %s to %d", addrbuf, fail_count);
5899 }
5900 } else { // Clear the failure
5901 info->active->mark_up();
5902 }
5903 }
5904#ifdef DEBUG
5905 ink_assert(std::chrono::system_clock::now() + t_state.txn_conf->down_server_timeout > time_down);
5906#endif
5907}
5908
5909void
5910HttpSM::set_ua_abort(HttpTransact::AbortState_t ua_abort, int event)

Callers 1

Calls 10

ErrnoClass · 0.85
FirstOfFunction · 0.85
errorFunction · 0.85
increment_fail_countMethod · 0.80
url_string_get_refMethod · 0.80
mark_upMethod · 0.80
ats_ip_nptopFunction · 0.50
nowClass · 0.50
host_getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected