cURL / Mailing Lists / curl-library / Single Mail

curl-library

Threaded resolver still blocked in Curl_resolver_cancel?

From: Mac Wang <liangyun.wang_at_gmail.com>
Date: Fri, 27 Apr 2012 01:32:16 -0700

Hi,

I am working on Android and have successfully built libcurl 7.25.0 with
threaded resolver support. I learnt through reading the source code that it
seems to only work with the multi interface, and switched to that.
In my test, I intentionally set DNS server to some stranger IP so DNS would
never work. I actually got timeout error from curl_multi_info_read within
the given time limit, but the call to curl_multi_remove_handle hung for a
few minutes before it came back.
It seems 'remove handle' actually calls Curl_done -> Curl_resolver_cancel,
and finally trying to 'join' that resolver thread.
Without curl_multi_remove_handle, I wouldn't be able to reuse that easy
handle. May I ask how threaded resolver is intended to be used?

Thanks!

My code looks like this:

initialization code:
 curl_easy_init <http://curl.haxx.se/libcurl/c/curl_easy_init.html>
 curl_multi_init <http://curl.haxx.se/libcurl/c/curl_multi_init.html>

begin actual transfer (this is called multiple times for different purposes)
curl_easy_reset
curl_easy_setopt <http://curl.haxx.se/libcurl/c/curl_easy_setopt.html>
 curl_multi_add_handle<http://curl.haxx.se/libcurl/c/curl_multi_add_handle.html>

loop:
 curl_multi_perform <http://curl.haxx.se/libcurl/c/curl_multi_perform.html>
 curl_multi_fdset <http://curl.haxx.se/libcurl/c/curl_multi_fdset.html>
select
end loop

 curl_multi_info_read<http://curl.haxx.se/libcurl/c/curl_multi_info_read.html>
 curl_multi_remove_handle<http://curl.haxx.se/libcurl/c/curl_multi_remove_handle.html>
end actual transfer

finalization code
curl_easy_cleanup <http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html>
 curl_multi_cleanup <http://curl.haxx.se/libcurl/c/curl_multi_cleanup.html>

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