diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-03-17 00:49:21 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-03-17 18:07:20 +0100 |
commit | e3a53e3efb942a5446a22725340e36af63f1632e (patch) | |
tree | 0797952e8cbc6762a980061f04943d042ac7ae71 /lib/conncache.c | |
parent | 76cc14ba43a5df551d67f3a9ea012059aea67a39 (diff) |
conncache: use conn->data to know if a transfer owns it
- make sure an already "owned" connection isn't returned unless
multiplexed.
- clear ->data when returning the connection to the cache again
Regression since 7.62.0 (probably in commit 1b76c38904f0)
Bug: https://curl.haxx.se/mail/lib-2019-03/0064.html
Closes #3686
Diffstat (limited to 'lib/conncache.c')
-rw-r--r-- | lib/conncache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/conncache.c b/lib/conncache.c index c975c456e..39302ba7b 100644 --- a/lib/conncache.c +++ b/lib/conncache.c @@ -433,6 +433,7 @@ bool Curl_conncache_return_conn(struct connectdata *conn) data->multi->maxconnects; struct connectdata *conn_candidate = NULL; + conn->data = NULL; /* no owner anymore */ if(maxconnects > 0 && Curl_conncache_size(data) > maxconnects) { infof(data, "Connection cache is full, closing the oldest one.\n"); @@ -476,7 +477,7 @@ Curl_conncache_extract_bundle(struct Curl_easy *data, while(curr) { conn = curr->ptr; - if(!CONN_INUSE(conn)) { + if(!CONN_INUSE(conn) && !conn->data) { /* Set higher score for the age passed since the connection was used */ score = Curl_timediff(now, conn->now); @@ -534,7 +535,7 @@ Curl_conncache_extract_oldest(struct Curl_easy *data) while(curr) { conn = curr->ptr; - if(!CONN_INUSE(conn)) { + if(!CONN_INUSE(conn) && !conn->data) { /* Set higher score for the age passed since the connection was used */ score = Curl_timediff(now, conn->now); |