curl-library
better(?) dns share locking
Date: Thu, 9 Oct 2003 15:32:28 +0200
Dear curl share users,
the current Curl_resolv uses a big lock (if enabled).
Following pseudo code visualize that:
lock
dns = Curl_hash_pic(...)
if(dns) {
addr = my_getaddrinfo(...)
if(addr) {
dns = cache_resolv_response(...,addr,...)
}
}
unlock
return dns
As you can see new dns requests blocks other dns requests
which might be already resolved.
I think following finer locking is better:
lock
dns = Curl_hash_pic(...)
unlock
if(dns) {
addr = my_getaddrinfo(...)
if(addr) {
lock
dns = cache_resolv_response(...,addr,...)
unlock
}
}
return dns
The attached patch does this locking. Applied to 7.10.7 I get
segmentation faults somewhere in curl code (sorry, I've forgot
to dump the debugging information). But with 7.10.8-pre8 the
seg fault disappears.
This patch has a side effect, which might be not ok for some users:
Multiple resolves for the same hostname are possible.
Avoiding this needs some more work...
Grettings,
Dirk
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
- text/x-diff attachment: curl-7.10.8-pre3-dnslock.diff