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

Method process_hostdb_info

src/proxy/http/HttpSM.cc:2299–2348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2297}
2298
2299void
2300HttpSM::process_hostdb_info(HostDBRecord *record)
2301{
2302 t_state.dns_info.record = record; // protect record.
2303
2304 bool use_client_addr = t_state.http_config_param->use_client_target_addr == 1 && t_state.client_info.is_transparent &&
2305 t_state.dns_info.os_addr_style == ResolveInfo::OS_Addr::TRY_DEFAULT;
2306
2307 t_state.dns_info.set_active(nullptr);
2308
2309 if (use_client_addr) {
2310 NetVConnection *vc = _ua.get_txn() ? _ua.get_txn()->get_netvc() : nullptr;
2311 if (vc) {
2312 t_state.dns_info.set_upstream_address(vc->get_local_addr());
2313 t_state.dns_info.os_addr_style = ResolveInfo::OS_Addr::TRY_CLIENT;
2314 }
2315 }
2316
2317 if (record && !record->is_failed()) {
2318 t_state.dns_info.inbound_remote_addr = &t_state.client_info.src_addr.sa;
2319 if (!use_client_addr) {
2320 t_state.dns_info.set_active(
2321 record->select_best_http(ts_clock::now(), t_state.txn_conf->down_server_timeout, t_state.dns_info.inbound_remote_addr));
2322 } else {
2323 // if use_client_target_addr is set, make sure the client addr is in the results pool
2324 t_state.dns_info.cta_validated_p = true;
2325 t_state.dns_info.record = record; // Cache this but do not make it active.
2326 if (record->find(t_state.dns_info.addr) == nullptr) {
2327 SMDbg(dbg_ctl_http, "use_client_target_addr == 1. Client specified address is not in the pool, not validated.");
2328 t_state.dns_info.cta_validated_p = false;
2329 }
2330 }
2331 } else {
2332 SMDbg(dbg_ctl_http, "DNS lookup failed for '%s'", t_state.dns_info.lookup_name);
2333 }
2334
2335 if (!t_state.dns_info.resolved_p) {
2336 SMDbg(dbg_ctl_http, "[%" PRId64 "] resolution failed for '%s'", sm_id, t_state.dns_info.lookup_name);
2337 }
2338
2339 ATS_PROBE1(milestone_dns_lookup_end, sm_id);
2340 milestones[TS_MILESTONE_DNS_LOOKUP_END] = ink_get_hrtime();
2341
2342 if (dbg_ctl_http_timeout.on()) {
2343 if (t_state.api_txn_dns_timeout_value != -1) {
2344 int foo = static_cast<int>(milestones.difference_msec(TS_MILESTONE_DNS_LOOKUP_BEGIN, TS_MILESTONE_DNS_LOOKUP_END));
2345 SMDbg(dbg_ctl_http_timeout, "DNS took: %d msec", foo);
2346 }
2347 }
2348}
2349
2350int
2351HttpSM::state_pre_resolve(int event, void * /* data ATS_UNUSED */)

Callers

nothing calls this directly

Calls 12

ink_get_hrtimeFunction · 0.85
get_txnMethod · 0.80
is_failedMethod · 0.80
select_best_httpMethod · 0.80
difference_msecMethod · 0.80
nowClass · 0.50
set_activeMethod · 0.45
get_netvcMethod · 0.45
set_upstream_addressMethod · 0.45
get_local_addrMethod · 0.45
findMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected