Lines Matching refs:dns
122 struct Curl_dns_entry *dns);
196 struct Curl_dns_entry *dns = (struct Curl_dns_entry *) hc; in hostcache_entry_is_stale() local
198 if(dns->timestamp) { in hostcache_entry_is_stale()
200 time_t age = prune->now - dns->timestamp; in hostcache_entry_is_stale()
240 if(!data->dns.hostcache) in Curl_hostcache_prune()
251 time_t oldest = hostcache_prune(data->dns.hostcache, timeout, now); in Curl_hostcache_prune()
261 (Curl_hash_count(data->dns.hostcache) > MAX_DNS_CACHE_SIZE)); in Curl_hostcache_prune()
280 struct Curl_dns_entry *dns = NULL; in fetch_addr() local
288 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1); in fetch_addr()
291 if(!dns && data->state.wildcard_resolve) { in fetch_addr()
295 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1); in fetch_addr()
298 if(dns && (data->set.dns_cache_timeout != -1)) { in fetch_addr()
306 if(hostcache_entry_is_stale(&user, dns)) { in fetch_addr()
308 dns = NULL; /* the memory deallocation is being handled by the hash */ in fetch_addr()
309 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1); in fetch_addr()
314 if(dns && data->conn->ip_version != CURL_IPRESOLVE_WHATEVER) { in fetch_addr()
317 struct Curl_addrinfo *addr = dns->addr; in fetch_addr()
334 dns = NULL; /* the memory deallocation is being handled by the hash */ in fetch_addr()
335 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1); in fetch_addr()
338 return dns; in fetch_addr()
360 struct Curl_dns_entry *dns = NULL; in Curl_fetch_addr() local
365 dns = fetch_addr(data, hostname, port); in Curl_fetch_addr()
367 if(dns) in Curl_fetch_addr()
368 dns->refcount++; /* we use it! */ in Curl_fetch_addr()
373 return dns; in Curl_fetch_addr()
477 struct Curl_dns_entry *dns; in Curl_cache_addr() local
492 dns = calloc(1, sizeof(struct Curl_dns_entry) + hostlen); in Curl_cache_addr()
493 if(!dns) { in Curl_cache_addr()
501 dns->refcount = 1; /* the cache has the first reference */ in Curl_cache_addr()
502 dns->addr = addr; /* this is the address(es) */ in Curl_cache_addr()
504 dns->timestamp = 0; /* an entry that never goes stale */ in Curl_cache_addr()
506 dns->timestamp = time(NULL); in Curl_cache_addr()
507 if(dns->timestamp == 0) in Curl_cache_addr()
508 dns->timestamp = 1; in Curl_cache_addr()
510 dns->hostport = port; in Curl_cache_addr()
512 memcpy(dns->hostname, hostname, hostlen); in Curl_cache_addr()
515 dns2 = Curl_hash_add(data->dns.hostcache, entry_id, entry_len + 1, in Curl_cache_addr()
516 (void *)dns); in Curl_cache_addr()
518 free(dns); in Curl_cache_addr()
522 dns = dns2; in Curl_cache_addr()
523 dns->refcount++; /* mark entry as in-use */ in Curl_cache_addr()
524 return dns; in Curl_cache_addr()
691 struct Curl_dns_entry *dns = NULL; in Curl_resolv() local
713 dns = fetch_addr(data, hostname, port); in Curl_resolv()
715 if(dns) { in Curl_resolv()
717 dns->refcount++; /* we use it! */ in Curl_resolv()
724 if(!dns) { in Curl_resolv()
823 result = Curl_resolv_check(data, &dns); in Curl_resolv()
826 if(dns) in Curl_resolv()
837 dns = Curl_cache_addr(data, addr, hostname, 0, port, FALSE); in Curl_resolv()
842 if(!dns) in Curl_resolv()
847 show_resolve_info(data, dns); in Curl_resolv()
852 *entry = dns; in Curl_resolv()
1054 struct Curl_dns_entry *dns = *pdns; in Curl_resolv_unlink() local
1059 hostcache_unlink_entry(dns); in Curl_resolv_unlink()
1070 struct Curl_dns_entry *dns = (struct Curl_dns_entry *) entry; in hostcache_unlink_entry() local
1071 DEBUGASSERT(dns && (dns->refcount > 0)); in hostcache_unlink_entry()
1073 dns->refcount--; in hostcache_unlink_entry()
1074 if(dns->refcount == 0) { in hostcache_unlink_entry()
1075 Curl_freeaddrinfo(dns->addr); in hostcache_unlink_entry()
1077 if(dns->hinfo) { in hostcache_unlink_entry()
1078 if(dns->hinfo->target) in hostcache_unlink_entry()
1079 free(dns->hinfo->target); in hostcache_unlink_entry()
1080 if(dns->hinfo->alpns) in hostcache_unlink_entry()
1081 free(dns->hinfo->alpns); in hostcache_unlink_entry()
1082 if(dns->hinfo->ipv4hints) in hostcache_unlink_entry()
1083 free(dns->hinfo->ipv4hints); in hostcache_unlink_entry()
1084 if(dns->hinfo->echconfiglist) in hostcache_unlink_entry()
1085 free(dns->hinfo->echconfiglist); in hostcache_unlink_entry()
1086 if(dns->hinfo->ipv6hints) in hostcache_unlink_entry()
1087 free(dns->hinfo->ipv6hints); in hostcache_unlink_entry()
1088 if(dns->hinfo->val) in hostcache_unlink_entry()
1089 free(dns->hinfo->val); in hostcache_unlink_entry()
1090 free(dns->hinfo); in hostcache_unlink_entry()
1093 free(dns); in hostcache_unlink_entry()
1162 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1); in Curl_loadhostpairs()
1168 struct Curl_dns_entry *dns; in Curl_loadhostpairs() local
1276 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1); in Curl_loadhostpairs()
1278 if(dns) { in Curl_loadhostpairs()
1292 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1); in Curl_loadhostpairs()
1296 dns = Curl_cache_addr(data, head, host_begin, hlen, port, permanent); in Curl_loadhostpairs()
1297 if(dns) { in Curl_loadhostpairs()
1300 dns->refcount--; in Curl_loadhostpairs()
1306 if(!dns) { in Curl_loadhostpairs()
1330 struct Curl_dns_entry *dns) in show_resolve_info() argument
1340 DEBUGASSERT(dns); in show_resolve_info()
1344 !dns->hostname[0] || Curl_host_is_ipnum(dns->hostname)) in show_resolve_info()
1347 a = dns->addr; in show_resolve_info()
1350 (dns->hostname[0] ? dns->hostname : "(none)"), dns->hostport); in show_resolve_info()
1394 struct Curl_dns_entry **dns) in Curl_resolv_check() argument
1399 (void)dns; in Curl_resolv_check()
1403 result = Curl_doh_is_resolved(data, dns); in Curl_resolv_check()
1407 result = Curl_resolver_is_resolved(data, dns); in Curl_resolv_check()
1408 if(*dns) in Curl_resolv_check()
1409 show_resolve_info(data, *dns); in Curl_resolv_check()
1442 if(data->state.async.dns) { in Curl_once_resolved()
1443 conn->dns_entry = data->state.async.dns; in Curl_once_resolved()
1444 data->state.async.dns = NULL; in Curl_once_resolved()