From: Eric Norris Date: Mon, 26 Aug 2024 19:13:46 +0000 (-0400) Subject: share: don't reinitialize conncache X-Git-Tag: curl-8_10_0~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dd0cb73a29e86fe4b66491df33a0a06994d8d55;p=thirdparty%2Fcurl.git share: don't reinitialize conncache Before this change, calling curl_share_setopt w/ CURL_LOCK_DATA_CONNECT a second time would re-initialize the connection cache, rather than use the existing one. After this change, calling curl_share_setopt w/ CURL_LOCK_DATA_CONNECT multiple times will have no effect after the first call. Closes #14696 --- diff --git a/lib/share.c b/lib/share.c index 3d0c2f5e45..9e83452a47 100644 --- a/lib/share.c +++ b/lib/share.c @@ -120,8 +120,11 @@ 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; + if(!share->conn_cache.hash.table) { + if(Curl_conncache_init(&share->conn_cache, NULL, 103)) { + res = CURLSHE_NOMEM; + } + } break; case CURL_LOCK_DATA_PSL: