Lines Matching refs:dns
261 if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache) in Curl_hostcache_prune()
272 hostcache_prune(data->dns.hostcache, in Curl_hostcache_prune()
294 struct Curl_dns_entry *dns = NULL; in fetch_addr() local
302 return dns; in fetch_addr()
307 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1); in fetch_addr()
309 if(dns && (data->set.dns_cache_timeout != -1)) { in fetch_addr()
316 if(hostcache_timestamp_remove(&user, dns)) { in fetch_addr()
318 dns = NULL; /* the memory deallocation is being handled by the hash */ in fetch_addr()
319 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len+1); in fetch_addr()
326 return dns; in fetch_addr()
349 struct Curl_dns_entry *dns = NULL; in Curl_fetch_addr() local
354 dns = fetch_addr(conn, hostname, port); in Curl_fetch_addr()
356 if(dns) dns->inuse++; /* we use it! */ in Curl_fetch_addr()
361 return dns; in Curl_fetch_addr()
381 struct Curl_dns_entry *dns; in Curl_cache_addr() local
392 dns = calloc(1, sizeof(struct Curl_dns_entry)); in Curl_cache_addr()
393 if(!dns) { in Curl_cache_addr()
398 dns->inuse = 1; /* the cache has the first reference */ in Curl_cache_addr()
399 dns->addr = addr; /* this is the address(es) */ in Curl_cache_addr()
400 time(&dns->timestamp); in Curl_cache_addr()
401 if(dns->timestamp == 0) in Curl_cache_addr()
402 dns->timestamp = 1; /* zero indicates CURLOPT_RESOLVE entry */ in Curl_cache_addr()
405 dns2 = Curl_hash_add(data->dns.hostcache, entry_id, entry_len+1, in Curl_cache_addr()
406 (void *)dns); in Curl_cache_addr()
408 free(dns); in Curl_cache_addr()
413 dns = dns2; in Curl_cache_addr()
414 dns->inuse++; /* mark entry as in-use */ in Curl_cache_addr()
419 return dns; in Curl_cache_addr()
448 struct Curl_dns_entry *dns = NULL; in Curl_resolv() local
458 dns = fetch_addr(conn, hostname, port); in Curl_resolv()
460 if(dns) { in Curl_resolv()
462 dns->inuse++; /* we use it! */ in Curl_resolv()
469 if(!dns) { in Curl_resolv()
496 result = Curl_resolver_is_resolved(conn, &dns); in Curl_resolv()
499 if(dns) in Curl_resolv()
510 dns = Curl_cache_addr(data, addr, hostname, port); in Curl_resolv()
515 if(!dns) in Curl_resolv()
523 *entry = dns; in Curl_resolv()
718 void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) in Curl_resolv_unlock() argument
723 freednsentry(dns); in Curl_resolv_unlock()
734 struct Curl_dns_entry *dns = (struct Curl_dns_entry *) freethis; in freednsentry() local
735 DEBUGASSERT(dns && (dns->inuse>0)); in freednsentry()
737 dns->inuse--; in freednsentry()
738 if(dns->inuse == 0) { in freednsentry()
739 Curl_freeaddrinfo(dns->addr); in freednsentry()
740 free(dns); in freednsentry()
806 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len+1); in Curl_loadhostpairs()
815 struct Curl_dns_entry *dns; in Curl_loadhostpairs() local
847 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1); in Curl_loadhostpairs()
852 if(!dns) { in Curl_loadhostpairs()
854 dns = Curl_cache_addr(data, addr, hostname, port); in Curl_loadhostpairs()
855 if(dns) { in Curl_loadhostpairs()
856 dns->timestamp = 0; /* mark as added by CURLOPT_RESOLVE */ in Curl_loadhostpairs()
859 dns->inuse--; in Curl_loadhostpairs()
869 if(!dns) { in Curl_loadhostpairs()