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
This commit is contained in:
Eric Norris 2024-08-26 15:13:46 -04:00 committed by Daniel Stenberg
parent c96551cea9
commit 8dd0cb73a2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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: