aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/share.c
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-10-18 20:31:38 +0300
committerGitHub <noreply@github.com>2024-10-18 20:31:38 +0300
commit2a74bac2d2d3bccb4e10120f1ead805640ec9dd0 (patch)
tree047e4818ced5aaf73f58517629e5260b5291f9f0 /contrib/libs/curl/lib/share.c
parent2d9656823e9521d8c29ea4c9a1d0eab78391abfc (diff)
parent3d834a1923bbf9403cd4a448e7f32b670aa4124f (diff)
downloadydb-2a74bac2d2d3bccb4e10120f1ead805640ec9dd0.tar.gz
Merge pull request #10502 from ydb-platform/mergelibs-241016-1210
Library import 241016-1210
Diffstat (limited to 'contrib/libs/curl/lib/share.c')
-rw-r--r--contrib/libs/curl/lib/share.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/contrib/libs/curl/lib/share.c b/contrib/libs/curl/lib/share.c
index 2ddaba6d7e..c0a8d806f3 100644
--- a/contrib/libs/curl/lib/share.c
+++ b/contrib/libs/curl/lib/share.c
@@ -26,12 +26,10 @@
#include <curl/curl.h>
#include "urldata.h"
-#include "connect.h"
#include "share.h"
#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"
@@ -66,7 +64,7 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
return CURLSHE_INVALID;
if(share->dirty)
- /* do not allow setting options while one or more handles are already
+ /* don't allow setting options while one or more handles are already
using this share */
return CURLSHE_IN_USE;
@@ -121,12 +119,8 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
break;
case CURL_LOCK_DATA_CONNECT:
- /* 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;
- }
+ if(Curl_conncache_init(&share->conn_cache, 103))
+ res = CURLSHE_NOMEM;
break;
case CURL_LOCK_DATA_PSL:
@@ -139,13 +133,13 @@ curl_share_setopt(struct Curl_share *share, CURLSHoption option, ...)
res = CURLSHE_BAD_OPTION;
}
if(!res)
- share->specifier |= (unsigned int)(1<<type);
+ share->specifier |= (1<<type);
break;
case CURLSHOPT_UNSHARE:
/* this is a type this share will no longer share */
type = va_arg(param, int);
- share->specifier &= ~(unsigned int)(1<<type);
+ share->specifier &= ~(1<<type);
switch(type) {
case CURL_LOCK_DATA_DNS:
break;
@@ -229,9 +223,8 @@ curl_share_cleanup(struct Curl_share *share)
return CURLSHE_IN_USE;
}
- if(share->specifier & (1 << CURL_LOCK_DATA_CONNECT)) {
- Curl_cpool_destroy(&share->cpool);
- }
+ Curl_conncache_close_all_connections(&share->conn_cache);
+ Curl_conncache_destroy(&share->conn_cache);
Curl_hash_destroy(&share->hostcache);
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
@@ -271,11 +264,11 @@ Curl_share_lock(struct Curl_easy *data, curl_lock_data type,
if(!share)
return CURLSHE_INVALID;
- if(share->specifier & (unsigned int)(1<<type)) {
+ if(share->specifier & (1<<type)) {
if(share->lockfunc) /* only call this if set! */
share->lockfunc(data, type, accesstype, share->clientdata);
}
- /* else if we do not share this, pretend successful lock */
+ /* else if we don't share this, pretend successful lock */
return CURLSHE_OK;
}
@@ -288,7 +281,7 @@ Curl_share_unlock(struct Curl_easy *data, curl_lock_data type)
if(!share)
return CURLSHE_INVALID;
- if(share->specifier & (unsigned int)(1<<type)) {
+ if(share->specifier & (1<<type)) {
if(share->unlockfunc) /* only call this if set! */
share->unlockfunc (data, type, share->clientdata);
}