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

Method lookup

src/iocore/hostdb/HostFile.cc:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65HostDBRecord::Handle
66HostFile::lookup(const HostDBHash &hash)
67{
68 HostDBRecord::Handle result;
69
70 // If looking for an IPv4 or IPv6 address, check the host file.
71 if (hash.db_mark == HOSTDB_MARK_IPV6 || hash.db_mark == HOSTDB_MARK_IPV4) {
72 if (auto spot = forward.find(hash.host_name); spot != forward.end()) {
73 result = (hash.db_mark == HOSTDB_MARK_IPV4) ? spot->second.record_4 : spot->second.record_6;
74 }
75 } else if (hash.db_mark != HOSTDB_MARK_SRV) {
76 if (auto spot = reverse.find(hash.ip); spot != reverse.end()) {
77 result = spot->second;
78 }
79 }
80
81 return result;
82}
83
84std::shared_ptr<HostFile>
85ParseHostFile(swoc::file::path const &path, ts_seconds interval)

Callers 2

test_HostFile.ccFile · 0.45
probe_hostfileFunction · 0.45

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected