-----Original Message-----
From: curl-library [mailto:[email protected]] On Behalf Of ext 
Dan Fandrich
Sent: April-16-13 2:04 PM
To: [email protected]
Subject: Re: libcurl + c-ares on Android

On Tue, Apr 16, 2013 at 06:34:55PM +0000, [email protected] 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

Thanks Dan.  As it turns out, calling curl_easy_init() and curl_easy_destroy() 
does fix the issue as you mentioned.  Thanks for pointing out the TODO in 
c-ares; I will be watching that one closely :)

For the record, if anyone else is looking for the current DNS servers on 
Android (since you so kindly pointed out they're not in /etc/resolv.conf) they 
can be viewed with:

adb shell getprop | grep net.dns

Cheers,
Jon

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to