curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Avoiding DNS cache sharing

From: Guillaume Quintard <guillaume.quintard_at_gmail.com>
Date: Mon, 16 Jul 2018 21:15:23 -0700

On Mon, Jul 16, 2018 at 3:32 PM Daniel Stenberg <daniel_at_haxx.se> wrote:
> You clearly wanted this email sent to the curl-library mailing list.

Indeed, thank you for correcting that.

> I don't understand what you want and what doesn't work! You said "the data
> goes into the cache and messes things up" and yet you said you explicitly want
> to share the DNS cache between the handles?
>
> When the CURLOPT_RESOLVE data goes into the cache, then if that cache is set
> to be held by a share object (that shares DNS), that DNS cache is shared
> between all easy handles that uses that same share object.

Sorry, let me try again. The ultimate goal is to have have multiple
threads that will have the same CURLOPT_URL, but that will all connect
to a different IP.

The goal was indeed to have one DNS cache per IP, so that even if a
cache contains multiples entries, at least they'll be the exact same.
But the code I posted didn't work.

Good news is I know why: I apparently needed to also share
CURL_LOCK_DATA_CONNECT in addition to CURL_LOCK_DATA_DNS. I assumed
the connection pool used the IP:PORT as key but instead it uses
HOST:PORT, right?

Anyway, problem solved, thank you for you time and attention.

Cheers!
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-07-17