From 16fa60a705759be0caf8f0949f35990bd48ba155 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 7 Nov 2011 04:11:20 +0100 Subject: [PATCH] oh wait. checking the hash is not enough. --- src/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 423fe93..04278fb 100644 --- a/src/core.c +++ b/src/core.c @@ -782,9 +782,10 @@ struct hostent* proxy_gethostbyname(const char *name) pthread_mutex_lock(&internal_ips_lock); #endif + // see if we already have this dns entry saved. if(internal_ips.counter) { for( i = 0; i < internal_ips.counter; i++) { - if(internal_ips.list[i]->hash == hash) { + if(internal_ips.list[i]->hash == hash && !strcmp(name, internal_ips.list[i]->string)) { resolved_addr = make_internal_ip(i); PDEBUG("got cached ip for %s\n", name); goto have_ip; @@ -792,6 +793,7 @@ struct hostent* proxy_gethostbyname(const char *name) } } + // grow list if needed. if(internal_ips.capa < internal_ips.counter + 1) { PDEBUG("realloc\n"); new_mem = realloc(internal_ips.list, (internal_ips.capa + 16) * sizeof(void*));