aboutsummaryrefslogtreecommitdiffstats
path: root/lib/conncache.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-08-03 14:37:21 -0700
committerElliott Hughes <enh@google.com>2018-08-03 14:37:21 -0700
commit72d948d9a2b7be19b761bd3c69ae851a2708f36c (patch)
treeb099486ec60f2b93bb10d5b4c4f08d1f5ea63c02 /lib/conncache.c
parentfedb562bb5945f38ff423cca9d8ed6b80e74bf8e (diff)
downloadexternal_curl-72d948d9a2b7be19b761bd3c69ae851a2708f36c.tar.gz
external_curl-72d948d9a2b7be19b761bd3c69ae851a2708f36c.tar.bz2
external_curl-72d948d9a2b7be19b761bd3c69ae851a2708f36c.zip
Update to curl 7.61.0 - July 11 2018.
Bug: N/A Test: builds, boots, `vendor/google/tools/fake-ota on streaming` works Change-Id: I9ae854de01fd5854f3a9e9a1b8443755fe8a22b4
Diffstat (limited to 'lib/conncache.c')
-rw-r--r--lib/conncache.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/lib/conncache.c b/lib/conncache.c
index b8f54448..76428eb8 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012 - 2016, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2012 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -96,14 +96,13 @@ static void bundle_destroy(struct connectbundle *cb_ptr)
}
/* Add a connection to a bundle */
-static CURLcode bundle_add_conn(struct connectbundle *cb_ptr,
- struct connectdata *conn)
+static void bundle_add_conn(struct connectbundle *cb_ptr,
+ struct connectdata *conn)
{
Curl_llist_insert_next(&cb_ptr->conn_list, cb_ptr->conn_list.tail, conn,
&conn->bundle_node);
conn->bundle = cb_ptr;
cb_ptr->num_connections++;
- return CURLE_OK;
}
/* Remove a connection from a bundle */
@@ -263,7 +262,7 @@ static void conncache_remove_bundle(struct conncache *connc,
CURLcode Curl_conncache_add_conn(struct conncache *connc,
struct connectdata *conn)
{
- CURLcode result;
+ CURLcode result = CURLE_OK;
struct connectbundle *bundle;
struct connectbundle *new_bundle = NULL;
struct Curl_easy *data = conn->data;
@@ -290,19 +289,13 @@ CURLcode Curl_conncache_add_conn(struct conncache *connc,
bundle = new_bundle;
}
- result = bundle_add_conn(bundle, conn);
- if(result) {
- if(new_bundle)
- conncache_remove_bundle(data->state.conn_cache, new_bundle);
- goto unlock;
- }
-
+ bundle_add_conn(bundle, conn);
conn->connection_id = connc->next_connection_id++;
connc->num_conn++;
DEBUGF(infof(conn->data, "Added connection %ld. "
- "The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n",
- conn->connection_id, (curl_off_t) connc->num_conn));
+ "The cache now contains %zu members\n",
+ conn->connection_id, connc->num_conn));
unlock:
CONN_UNLOCK(data);
@@ -328,9 +321,8 @@ void Curl_conncache_remove_conn(struct connectdata *conn, bool lock)
conn->bundle = NULL; /* removed from it */
if(connc) {
connc->num_conn--;
- DEBUGF(infof(conn->data, "The cache now contains %"
- CURL_FORMAT_CURL_OFF_TU " members\n",
- (curl_off_t) connc->num_conn));
+ DEBUGF(infof(conn->data, "The cache now contains %zu members\n",
+ connc->num_conn));
}
if(lock) {
CONN_UNLOCK(conn->data);
@@ -452,6 +444,7 @@ bool Curl_conncache_return_conn(struct connectdata *conn)
}
CONN_LOCK(data);
conn->inuse = FALSE; /* Mark the connection unused */
+ conn->data = NULL; /* no owner */
CONN_UNLOCK(data);
return (conn_candidate == conn) ? FALSE : TRUE;
@@ -501,9 +494,8 @@ Curl_conncache_extract_bundle(struct Curl_easy *data,
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle, conn_candidate);
data->state.conn_cache->num_conn--;
- DEBUGF(infof(data, "The cache now contains %"
- CURL_FORMAT_CURL_OFF_TU " members\n",
- (curl_off_t) data->state.conn_cache->num_conn));
+ DEBUGF(infof(data, "The cache now contains %zu members\n",
+ data->state.conn_cache->num_conn));
}
return conn_candidate;
@@ -563,9 +555,8 @@ Curl_conncache_extract_oldest(struct Curl_easy *data)
/* remove it to prevent another thread from nicking it */
bundle_remove_conn(bundle_candidate, conn_candidate);
connc->num_conn--;
- DEBUGF(infof(data, "The cache now contains %"
- CURL_FORMAT_CURL_OFF_TU " members\n",
- (curl_off_t) connc->num_conn));
+ DEBUGF(infof(data, "The cache now contains %zu members\n",
+ connc->num_conn));
}
CONN_UNLOCK(data);