From f73de32d469919478fba65b5f4fda6212dc730cd Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 7 Mar 2019 15:39:43 +0100 Subject: CURLOPT_DNS_USE_GLOBAL_CACHE: remove Remove the code too. The functionality has been disabled in code since 7.62.0. Setting this option will from now on simply be ignored and have no function. Closes #3654 --- tests/unit/unit1609.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) (limited to 'tests/unit/unit1609.c') diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c index 865c9e459..8d9bc6526 100644 --- a/tests/unit/unit1609.c +++ b/tests/unit/unit1609.c @@ -31,12 +31,8 @@ bool getaddressinfo(struct sockaddr *sa, char *addr, long *port); #include "memdebug.h" /* LAST include file */ -static struct Curl_easy *easy; -static struct curl_hash *hostcache; - static void unit_stop(void) { - curl_easy_cleanup(easy); curl_global_cleanup(); } @@ -46,18 +42,6 @@ static CURLcode unit_setup(void) global_init(CURL_GLOBAL_ALL); - easy = curl_easy_init(); - if(!easy) { - curl_global_cleanup(); - return CURLE_OUT_OF_MEMORY; - } - - hostcache = Curl_global_host_cache_init(); - if(!hostcache) { - unit_stop(); - return CURLE_OUT_OF_MEMORY; - } - return res; } @@ -117,17 +101,15 @@ static const struct testcase tests[] = { }; UNITTEST_START +{ int i; int testnum = sizeof(tests) / sizeof(struct testcase); /* important: we setup cache outside of the loop and also clean cache after the loop. In contrast,for example, test 1607 sets up and cleans cache on each iteration. */ - Curl_hostcache_clean(easy, hostcache); - easy->dns.hostcache = hostcache; - easy->dns.hostcachetype = HCACHE_GLOBAL; - for(i = 0; i < testnum; ++i, curl_easy_reset(easy)) { + for(i = 0; i < testnum; ++i) { int j; int addressnum = sizeof (tests[i].address) / sizeof (*tests[i].address); struct Curl_addrinfo *addr; @@ -135,6 +117,16 @@ UNITTEST_START struct curl_slist *list; void *entry_id; bool problem = false; + struct Curl_multi *multi; + struct Curl_easy *easy = curl_easy_init(); + if(!easy) { + curl_global_cleanup(); + return CURLE_OUT_OF_MEMORY; + } + /* create a multi handle and add the easy handle to it so that the + hostcache is setup */ + multi = curl_multi_init(); + curl_multi_add_handle(multi, easy); list = curl_slist_append(NULL, tests[i].optval); if(!list) @@ -205,6 +197,9 @@ UNITTEST_START addr = addr->ai_next; } + curl_easy_cleanup(easy); + Curl_hash_destroy(&multi->hostcache); + curl_multi_cleanup(multi); curl_slist_free_all(list); if(problem) { @@ -212,7 +207,5 @@ UNITTEST_START continue; } } - - Curl_hostcache_clean(easy, easy->dns.hostcache); - +} UNITTEST_STOP -- cgit v1.2.3