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

Method refresh

src/iocore/hostdb/HostDB.cc:197–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void
198HostDBHash::refresh()
199{
200 CryptoContext ctx;
201
202 if (host_name) {
203 const char *server_line = dns_server ? dns_server->x_dns_ip_line : nullptr;
204 uint8_t m = static_cast<uint8_t>(db_mark); // be sure of the type.
205
206 ctx.update(host_name.data(), host_name.size());
207 ctx.update(reinterpret_cast<uint8_t *>(&port), sizeof(port));
208 ctx.update(&m, sizeof(m));
209 if (server_line) {
210 ctx.update(server_line, strlen(server_line));
211 }
212 } else {
213 // CryptoHash the ip, pad on both sizes with 0's
214 // so that it does not intersect the string space
215 //
216 char buff[TS_IP6_SIZE + 4];
217 int n = ip.isIp6() ? sizeof(in6_addr) : sizeof(in_addr_t);
218 memset(buff, 0, 2);
219 memcpy(buff + 2, ip._addr._byte, n);
220 memset(buff + 2 + n, 0, 2);
221 ctx.update(buff, n + 4);
222 }
223 ctx.finalize(hash);
224}
225
226HostDBHash::~HostDBHash()
227{

Callers 7

refresh_hashMethod · 0.45
getbyMethod · 0.45
getbyname_reMethod · 0.45
getbynameport_reMethod · 0.45
getbyaddr_reMethod · 0.45
getSRVbyname_immMethod · 0.45
getbyname_immMethod · 0.45

Calls 7

memsetFunction · 0.85
isIp6Method · 0.80
memcpyFunction · 0.50
updateMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected