cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl + c-ares on Android

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 16 Apr 2013 23:03:45 +0200

On Tue, Apr 16, 2013 at 06:34:55PM +0000, jonathan.p.richardson_at_nokia.com wrote:
> I'm using libcurl 7.29.0 on Android with c-ares 1.9.1.
>
> I've been noticing a bug on a Samsung Galaxy S3 & Samsung Galaxy Note 2 (and possibly other devices too) when the bearer switches from wifi to 3G where I can no longer connect to a host.
>
> If I undefine USE_ARES (build without c-ares) then this issue is gone, but I would like to keep c-ares for performance.
>
> Some other (useful?) info:
> 1) Switching back to the original bearer will allow a connection again
> 2) I tried performing a curl_global_cleanup() and curl_global_init(CURL_GLOBAL_ALL) during the switch, but it didn't seem to help.
>
> If anyone knows of anything that I can do to continue to use c-ares I would greatly appreciate it!

I'm guessing here based on little information that you've given, but I
suspect that it has to do with changing DNS hosts. c-ares uses the Android
means of specifying DNS servers (i.e. not /etc/resolv.conf) but it initializes
them once at startup time and never again (for both Android and
/etc/resolv.conf). There's a TODO item in c-ares to add a ares_reinit()
function to allow the application to force it to update itself with new
DNS servers but at the moment, about all you can do is tear down c-ares
and initialize it from scratch if this happens.

>>> Dan

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-16