Loading lib/hostip.c +10 −11 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -332,12 +332,13 @@ sigjmp_buf curl_jmpenv; struct Curl_dns_entry * Curl_fetch_addr(struct connectdata *conn, const char *hostname, int port, int *stale) int port) { char *entry_id = NULL; struct Curl_dns_entry *dns = NULL; size_t entry_len; struct SessionHandle *data = conn->data; int stale; /* Create an entry id, based upon the hostname and port */ entry_id = create_hostcache_id(hostname, port); Loading @@ -354,9 +355,11 @@ Curl_fetch_addr(struct connectdata *conn, free(entry_id); /* See whether the returned entry is stale. Done before we release lock */ *stale = remove_entry_if_stale(data, dns); if(*stale) stale = remove_entry_if_stale(data, dns); if(stale) { infof(data, "Hostname in DNS cache was stale, zapped\n"); dns = NULL; /* the memory deallocation is being handled by the hash */ } return dns; } Loading Loading @@ -448,21 +451,17 @@ int Curl_resolv(struct connectdata *conn, struct Curl_dns_entry *dns = NULL; struct SessionHandle *data = conn->data; CURLcode result; int stale, rc = CURLRESOLV_ERROR; /* default to failure */ int rc = CURLRESOLV_ERROR; /* default to failure */ *entry = NULL; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns = Curl_fetch_addr(conn, hostname, port, &stale); infof(data, "Hostname was %sfound in DNS cache\n", dns||stale?"":"NOT "); if(stale) infof(data, "Hostname in DNS cache was stale, zapped\n"); dns = Curl_fetch_addr(conn, hostname, port); if(dns) { infof(data, "Hostname %s was found in DNS cache\n", hostname); dns->inuse++; /* we use it! */ rc = CURLRESOLV_RESOLVED; } Loading lib/hostip.h +2 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -179,9 +179,7 @@ const char *Curl_printable_address(const Curl_addrinfo *ip, struct Curl_dns_entry * Curl_fetch_addr(struct connectdata *conn, const char *hostname, int port, int *stale); int port); /* * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. * Loading lib/multi.c +2 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -1096,13 +1096,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, { struct Curl_dns_entry *dns = NULL; struct connectdata *conn = data->easy_conn; int stale; /* check if we have the name resolved by now */ if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns = Curl_fetch_addr(conn, conn->host.name, (int)conn->port, &stale); dns = Curl_fetch_addr(conn, conn->host.name, (int)conn->port); if(dns) { dns->inuse++; /* we use it! */ Loading @@ -1113,8 +1112,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = CURLE_OK; infof(data, "Hostname was found in DNS cache\n"); } if(stale) infof(data, "Hostname in DNS cache was stale, zapped\n"); if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); Loading Loading
lib/hostip.c +10 −11 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -332,12 +332,13 @@ sigjmp_buf curl_jmpenv; struct Curl_dns_entry * Curl_fetch_addr(struct connectdata *conn, const char *hostname, int port, int *stale) int port) { char *entry_id = NULL; struct Curl_dns_entry *dns = NULL; size_t entry_len; struct SessionHandle *data = conn->data; int stale; /* Create an entry id, based upon the hostname and port */ entry_id = create_hostcache_id(hostname, port); Loading @@ -354,9 +355,11 @@ Curl_fetch_addr(struct connectdata *conn, free(entry_id); /* See whether the returned entry is stale. Done before we release lock */ *stale = remove_entry_if_stale(data, dns); if(*stale) stale = remove_entry_if_stale(data, dns); if(stale) { infof(data, "Hostname in DNS cache was stale, zapped\n"); dns = NULL; /* the memory deallocation is being handled by the hash */ } return dns; } Loading Loading @@ -448,21 +451,17 @@ int Curl_resolv(struct connectdata *conn, struct Curl_dns_entry *dns = NULL; struct SessionHandle *data = conn->data; CURLcode result; int stale, rc = CURLRESOLV_ERROR; /* default to failure */ int rc = CURLRESOLV_ERROR; /* default to failure */ *entry = NULL; if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns = Curl_fetch_addr(conn, hostname, port, &stale); infof(data, "Hostname was %sfound in DNS cache\n", dns||stale?"":"NOT "); if(stale) infof(data, "Hostname in DNS cache was stale, zapped\n"); dns = Curl_fetch_addr(conn, hostname, port); if(dns) { infof(data, "Hostname %s was found in DNS cache\n", hostname); dns->inuse++; /* we use it! */ rc = CURLRESOLV_RESOLVED; } Loading
lib/hostip.h +2 −4 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -179,9 +179,7 @@ const char *Curl_printable_address(const Curl_addrinfo *ip, struct Curl_dns_entry * Curl_fetch_addr(struct connectdata *conn, const char *hostname, int port, int *stale); int port); /* * Curl_cache_addr() stores a 'Curl_addrinfo' struct in the DNS cache. * Loading
lib/multi.c +2 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms Loading Loading @@ -1096,13 +1096,12 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, { struct Curl_dns_entry *dns = NULL; struct connectdata *conn = data->easy_conn; int stale; /* check if we have the name resolved by now */ if(data->share) Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns = Curl_fetch_addr(conn, conn->host.name, (int)conn->port, &stale); dns = Curl_fetch_addr(conn, conn->host.name, (int)conn->port); if(dns) { dns->inuse++; /* we use it! */ Loading @@ -1113,8 +1112,6 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = CURLE_OK; infof(data, "Hostname was found in DNS cache\n"); } if(stale) infof(data, "Hostname in DNS cache was stale, zapped\n"); if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); Loading