summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/share.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/share.c')
-rw-r--r--libs/libcurl/src/share.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/libcurl/src/share.c b/libs/libcurl/src/share.c
index d233ffa116..5f63a8ee13 100644
--- a/libs/libcurl/src/share.c
+++ b/libs/libcurl/src/share.c
@@ -31,6 +31,7 @@
#include "psl.h"
#include "vtls/vtls.h"
#include "hsts.h"
+#include "url.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -120,8 +121,12 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
break;
case CURL_LOCK_DATA_CONNECT:
- if(Curl_conncache_init(&share->conn_cache, NULL, 103))
- res = CURLSHE_NOMEM;
+ /* It is safe to set this option several times on a share. */
+ if(!share->cpool.idata) {
+ if(Curl_cpool_init(&share->cpool, Curl_on_disconnect,
+ NULL, share, 103))
+ res = CURLSHE_NOMEM;
+ }
break;
case CURL_LOCK_DATA_PSL:
@@ -224,8 +229,9 @@ curl_share_cleanup(struct Curl_share *share)
return CURLSHE_IN_USE;
}
- Curl_conncache_close_all_connections(&share->conn_cache);
- Curl_conncache_destroy(&share->conn_cache);
+ if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) {
+ Curl_cpool_destroy(&share->cpool);
+ }
Curl_hash_destroy(&share->hostcache);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)