diff options
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 31 |
1 files changed, 18 insertions, 13 deletions
@@ -204,6 +204,12 @@ CURLcode Curl_close(struct SessionHandle *data) /* Loop through all open connections and kill them one by one */ while(-1 != ConnectionKillOne(data)); + if ( ! (data->share && data->share->hostcache) ) { + if ( !Curl_global_host_cache_use(data)) { + Curl_hash_destroy(data->hostcache); + } + } + #ifdef USE_SSLEAY /* Close down all open SSL info and sessions */ Curl_SSL_Close_All(data); @@ -1432,6 +1438,17 @@ CURLcode Curl_disconnect(struct connectdata *conn) data = conn->data; + if(conn->dns_entry) + Curl_resolv_unlock(data, conn->dns_entry); /* done with this */ + +#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST) + /* scan for DNS cache entries still marked as in use */ + Curl_hash_apply(data->hostcache, + NULL, Curl_scan_cache_used); +#endif + + Curl_hostcache_prune(data); /* kill old DNS cache entries */ + /* * The range string is usually freed in curl_done(), but we might * get here *instead* if we fail prematurely. Thus we need to be able @@ -3230,8 +3247,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, if(conn->bits.reuse) { /* re-used connection, no resolving is necessary */ hostaddr = NULL; - conn->dns_entry = NULL; /* we don't connect now so we don't have any fresh - dns entry struct to point to */ + /* we'll need to clear conn->dns_entry later in Curl_disconnect() */ if (conn->bits.httpproxy) fix_hostname(conn, &conn->host); @@ -3480,17 +3496,6 @@ CURLcode Curl_done(struct connectdata **connp, conn->newurl = NULL; } - if(conn->dns_entry) - Curl_resolv_unlock(conn->data, conn->dns_entry); /* done with this */ - -#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST) - /* scan for DNS cache entries still marked as in use */ - Curl_hash_apply(data->hostcache, - NULL, Curl_scan_cache_used); -#endif - - Curl_hostcache_prune(data); /* kill old DNS cache entries */ - /* this calls the protocol-specific function pointer previously set */ if(conn->curl_done) result = conn->curl_done(conn, status); |