mirror of
https://github.com/curl/curl.git
synced 2026-08-25 16:13:32 +03:00
conncache: remove name arg from Curl_conncache_find_bundle
To simplify, and also since the returned name is not the full actual name used for the check. The port number and zone id is also involved, so just showing the name is misleading. Closes #8750
This commit is contained in:
parent
5295e8d64a
commit
030adbceeb
3 changed files with 15 additions and 28 deletions
|
|
@ -132,13 +132,11 @@ void Curl_conncache_destroy(struct conncache *connc)
|
|||
}
|
||||
|
||||
/* creates a key to find a bundle for this connection */
|
||||
static void hashkey(struct connectdata *conn, char *buf,
|
||||
size_t len, /* something like 128 is fine */
|
||||
const char **hostp)
|
||||
static void hashkey(struct connectdata *conn, char *buf, size_t len)
|
||||
{
|
||||
const char *hostname;
|
||||
long port = conn->remote_port;
|
||||
|
||||
DEBUGASSERT(len >= HASHKEY_SIZE);
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
|
||||
hostname = conn->http_proxy.host.name;
|
||||
|
|
@ -151,10 +149,6 @@ static void hashkey(struct connectdata *conn, char *buf,
|
|||
else
|
||||
hostname = conn->host.name;
|
||||
|
||||
if(hostp)
|
||||
/* report back which name we used */
|
||||
*hostp = hostname;
|
||||
|
||||
/* put the numbers first so that the hostname gets cut off if too long */
|
||||
#ifdef ENABLE_IPV6
|
||||
msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
|
||||
|
|
@ -183,14 +177,13 @@ size_t Curl_conncache_size(struct Curl_easy *data)
|
|||
struct connectbundle *
|
||||
Curl_conncache_find_bundle(struct Curl_easy *data,
|
||||
struct connectdata *conn,
|
||||
struct conncache *connc,
|
||||
const char **hostp)
|
||||
struct conncache *connc)
|
||||
{
|
||||
struct connectbundle *bundle = NULL;
|
||||
CONNCACHE_LOCK(data);
|
||||
if(connc) {
|
||||
char key[HASHKEY_SIZE];
|
||||
hashkey(conn, key, sizeof(key), hostp);
|
||||
hashkey(conn, key, sizeof(key));
|
||||
bundle = Curl_hash_pick(&connc->hash, key, strlen(key));
|
||||
}
|
||||
|
||||
|
|
@ -237,8 +230,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
|
|||
DEBUGASSERT(conn);
|
||||
|
||||
/* *find_bundle() locks the connection cache */
|
||||
bundle = Curl_conncache_find_bundle(data, conn, data->state.conn_cache,
|
||||
NULL);
|
||||
bundle = Curl_conncache_find_bundle(data, conn, data->state.conn_cache);
|
||||
if(!bundle) {
|
||||
char key[HASHKEY_SIZE];
|
||||
|
||||
|
|
@ -247,7 +239,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
|
|||
goto unlock;
|
||||
}
|
||||
|
||||
hashkey(conn, key, sizeof(key), NULL);
|
||||
hashkey(conn, key, sizeof(key));
|
||||
|
||||
if(!conncache_add_bundle(data->state.conn_cache, key, bundle)) {
|
||||
bundle_destroy(bundle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue