Home | History | Annotate | Download | only in lib

Lines Matching refs:dns

109 /* These two symbols are for the global DNS cache */
116 * Curl_global_host_cache_init() initializes and sets up a global DNS cache.
117 * Global DNS cache is general badness. Do not use. This will be removed in
135 * Destroy and cleanup the global DNS cache
196 * the DNS caching.
220 * This function is set as a callback to be called for every entry in the DNS
238 * Prune the DNS cache. This assumes that a lock has already been taken.
254 * Library-wide function for pruning the DNS cache. This function takes and
261 if((data->set.dns_cache_timeout == -1) || !data->dns.hostcache)
272 hostcache_prune(data->dns.hostcache,
294 struct Curl_dns_entry *dns = NULL;
302 return dns;
306 /* See if its already in our dns cache */
307 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1);
309 if(dns && (data->set.dns_cache_timeout != -1)) {
316 if(hostcache_timestamp_remove(&user, dns)) {
317 infof(data, "Hostname in DNS cache was stale, zapped\n");
318 dns = NULL; /* the memory deallocation is being handled by the hash */
319 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len+1);
326 return dns;
330 * Curl_fetch_addr() fetches a 'Curl_dns_entry' already in the DNS cache.
335 * the DNS cache. This short circuits waiting for a lot of pending
349 struct Curl_dns_entry *dns = NULL;
354 dns = fetch_addr(conn, hostname, port);
356 if(dns)
357 dns->inuse++; /* we use it! */
362 return dns;
366 * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache.
369 * address, we call this function to store the information in the dns
382 struct Curl_dns_entry *dns;
393 dns = calloc(1, sizeof(struct Curl_dns_entry));
394 if(!dns) {
399 dns->inuse = 1; /* the cache has the first reference */
400 dns->addr = addr; /* this is the address(es) */
401 time(&dns->timestamp);
402 if(dns->timestamp == 0)
403 dns->timestamp = 1; /* zero indicates CURLOPT_RESOLVE entry */
405 /* Store the resolved data in our DNS cache. */
406 dns2 = Curl_hash_add(data->dns.hostcache, entry_id, entry_len+1,
407 (void *)dns);
409 free(dns);
414 dns = dns2;
415 dns->inuse++; /* mark entry as in-use */
420 return dns;
449 struct Curl_dns_entry *dns = NULL;
459 dns = fetch_addr(conn, hostname, port);
461 if(dns) {
462 infof(data, "Hostname %s was found in DNS cache\n", hostname);
463 dns->inuse++; /* we use it! */
470 if(!dns) {
497 result = Curl_resolver_is_resolved(conn, &dns);
500 if(dns)
511 dns = Curl_cache_addr(data, addr, hostname, port);
516 if(!dns)
524 *entry = dns;
713 * Curl_resolv_unlock() unlocks the given cached DNS entry. When this has been
719 void Curl_resolv_unlock(struct Curl_easy *data, struct Curl_dns_entry *dns)
724 freednsentry(dns);
731 * File-internal: release cache dns entry reference, free if inuse drops to 0
735 struct Curl_dns_entry *dns = (struct Curl_dns_entry *) freethis;
736 DEBUGASSERT(dns && (dns->inuse>0));
738 dns->inuse--;
739 if(dns->inuse == 0) {
740 Curl_freeaddrinfo(dns->addr);
741 free(dns);
746 * Curl_mk_dnscache() inits a new DNS cache and returns success/failure.
807 Curl_hash_delete(data->dns.hostcache, entry_id, entry_len+1);
816 struct Curl_dns_entry *dns;
847 /* See if its already in our dns cache */
848 dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1);
853 if(!dns) {
855 dns = Curl_cache_addr(data, addr, hostname, port);
856 if(dns) {
857 dns->timestamp = 0; /* mark as added by CURLOPT_RESOLVE */
860 dns->inuse--;
870 if(!dns) {
874 infof(data, "Added %s:%d:%s to DNS cache\n",