Date: Tue, 15 Feb 2011 01:11:10 -0700
Cross-posting this to curl list because I've got some comments here
and no comments on c-ares list.
* adds an ares_reinit functon, which reinitializes the channel same
way as ares_init.
* patches ares_gethostbyname and ares_gethostbyaddr with automatic updates.
* ares_getnameinfo is essentially patched as it calls either of the
* ares_query and ares-search functions are not patched because they
can be called from ares_gethostbyxxxx and changing channel in the
middle could break things.
* If dns settings have changed all outstanding requests on a given
channel are cancelled.
* I didn't add ares_reinit_options() and I don't try to save old
options in ares_reinit().
In practice my patch only does the right thing in the following case:
* channel is intialized with ares_init(), without options
* only gethostbyname, gethostbyaddr and getnameinfo are used.
* dns settings change reasonably infrequently -- otherwise many
resolvs could be dropped
* dns settings are not overly complex -- otherwise reinit overhead
might be noticeable
Basically it works for my case, that is roaming between wireless networks.
Comments and suggestions are welcome.
- application/octet-stream attachment: ares_reinit.patch