Loading include/curl/curl.h +9 −4 Original line number Diff line number Diff line Loading @@ -902,10 +902,15 @@ typedef enum { /* Different data locks for a single share */ typedef enum { CURL_LOCK_DATA_NONE = 0, CURL_LOCK_DATA_COOKIE = 1, CURL_LOCK_DATA_DNS = 2, CURL_LOCK_DATA_SSL_SESSION = 3, CURL_LOCK_DATA_CONNECT = 4, /* CURL_LOCK_DATA_SHARE is used internaly to say that * the locking is just made to change the internal state of the share * itself. */ CURL_LOCK_DATA_SHARE, CURL_LOCK_DATA_COOKIE, CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_DATA_CONNECT, CURL_LOCK_DATA_LAST } curl_lock_data; Loading lib/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ getpass.c netrc.c telnet.h getinfo.c getinfo.h transfer.c strequal.c \ strequal.h easy.c security.h security.c krb4.c krb4.h memdebug.c \ memdebug.h inet_ntoa_r.h http_chunks.c http_chunks.h strtok.c strtok.h \ connect.c connect.h llist.c llist.h hash.c hash.h multi.c \ content_encoding.c content_encoding.h share.h content_encoding.c content_encoding.h share.c share.h noinst_HEADERS = setup.h transfer.h Loading lib/connect.c +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ static CURLcode bindlocal(struct connectdata *conn, if ( h ) { Curl_addrinfo *addr = h->addr; Curl_resolv_unlock(h); Curl_resolv_unlock(data, h); /* we don't need it anymore after this function has returned */ #ifdef ENABLE_IPV6 Loading lib/ftp.c +2 −2 Original line number Diff line number Diff line Loading @@ -1233,7 +1233,7 @@ CURLcode ftp_use_port(struct connectdata *conn) if(h) /* when we return from here, we can forget about this */ Curl_resolv_unlock(h); Curl_resolv_unlock(data, h); if ( h || sa_filled_in) { if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { Loading Loading @@ -1497,7 +1497,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, &conninfo, connected); Curl_resolv_unlock(addr); /* we're done using this address */ Curl_resolv_unlock(data, addr); /* we're done using this address */ /* * When this is used from the multi interface, this might've returned with Loading lib/hostip.c +24 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" #include "share.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> Loading Loading @@ -211,6 +212,10 @@ void Curl_scan_cache_used(void *user, void *ptr) #define HOSTCACHE_RETURN(dns) \ { \ free(entry_id); \ if(data->share) \ { \ Curl_share_unlock(data, CURL_LOCK_DATA_DNS); \ } \ return dns; \ } Loading Loading @@ -246,6 +251,11 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, if (!entry_id) return NULL; if(data->share) { Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); } /* See if its already in our dns cache */ dns = Curl_hash_pick(data->hostcache, entry_id, entry_len+1); Loading Loading @@ -284,6 +294,19 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, HOSTCACHE_RETURN(dns); } void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) { if(data->share) { Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); } dns->inuse--; if(data->share) { Curl_share_unlock(data, CURL_LOCK_DATA_DNS); } } /* * This is a wrapper function for freeing name information in a protocol * independent way. This takes care of using the appropriate underlaying Loading Loading
include/curl/curl.h +9 −4 Original line number Diff line number Diff line Loading @@ -902,10 +902,15 @@ typedef enum { /* Different data locks for a single share */ typedef enum { CURL_LOCK_DATA_NONE = 0, CURL_LOCK_DATA_COOKIE = 1, CURL_LOCK_DATA_DNS = 2, CURL_LOCK_DATA_SSL_SESSION = 3, CURL_LOCK_DATA_CONNECT = 4, /* CURL_LOCK_DATA_SHARE is used internaly to say that * the locking is just made to change the internal state of the share * itself. */ CURL_LOCK_DATA_SHARE, CURL_LOCK_DATA_COOKIE, CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_DATA_CONNECT, CURL_LOCK_DATA_LAST } curl_lock_data; Loading
lib/Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ getpass.c netrc.c telnet.h getinfo.c getinfo.h transfer.c strequal.c \ strequal.h easy.c security.h security.c krb4.c krb4.h memdebug.c \ memdebug.h inet_ntoa_r.h http_chunks.c http_chunks.h strtok.c strtok.h \ connect.c connect.h llist.c llist.h hash.c hash.h multi.c \ content_encoding.c content_encoding.h share.h content_encoding.c content_encoding.h share.c share.h noinst_HEADERS = setup.h transfer.h Loading
lib/connect.c +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ static CURLcode bindlocal(struct connectdata *conn, if ( h ) { Curl_addrinfo *addr = h->addr; Curl_resolv_unlock(h); Curl_resolv_unlock(data, h); /* we don't need it anymore after this function has returned */ #ifdef ENABLE_IPV6 Loading
lib/ftp.c +2 −2 Original line number Diff line number Diff line Loading @@ -1233,7 +1233,7 @@ CURLcode ftp_use_port(struct connectdata *conn) if(h) /* when we return from here, we can forget about this */ Curl_resolv_unlock(h); Curl_resolv_unlock(data, h); if ( h || sa_filled_in) { if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) { Loading Loading @@ -1497,7 +1497,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn, &conninfo, connected); Curl_resolv_unlock(addr); /* we're done using this address */ Curl_resolv_unlock(data, addr); /* we're done using this address */ /* * When this is used from the multi interface, this might've returned with Loading
lib/hostip.c +24 −1 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ #include "sendf.h" #include "hostip.h" #include "hash.h" #include "share.h" #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> Loading Loading @@ -211,6 +212,10 @@ void Curl_scan_cache_used(void *user, void *ptr) #define HOSTCACHE_RETURN(dns) \ { \ free(entry_id); \ if(data->share) \ { \ Curl_share_unlock(data, CURL_LOCK_DATA_DNS); \ } \ return dns; \ } Loading Loading @@ -246,6 +251,11 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, if (!entry_id) return NULL; if(data->share) { Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); } /* See if its already in our dns cache */ dns = Curl_hash_pick(data->hostcache, entry_id, entry_len+1); Loading Loading @@ -284,6 +294,19 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, HOSTCACHE_RETURN(dns); } void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) { if(data->share) { Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); } dns->inuse--; if(data->share) { Curl_share_unlock(data, CURL_LOCK_DATA_DNS); } } /* * This is a wrapper function for freeing name information in a protocol * independent way. This takes care of using the appropriate underlaying Loading