]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
share: don't reinitialize conncache
authorEric Norris <enorris@etsy.com>
Mon, 26 Aug 2024 19:13:46 +0000 (15:13 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 27 Aug 2024 06:37:45 +0000 (08:37 +0200)
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

lib/share.c

index 3d0c2f5e45964e1667084a0f78d6e8b4af6b2d21..9e83452a4702705b24e772b28e49afe5225f6caa 100644 (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: