diff options
author | Brad King <brad.king@kitware.com> | 2018-01-24 19:17:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-01-24 19:18:16 (GMT) |
commit | cd8e31a1bf7429514078c2923a1a9580113f9d4f (patch) | |
tree | 6a0b8a01e3e0e52bb4b3abb66ce9e992614af6a7 /Utilities/cmcurl/lib/conncache.h | |
parent | e9c8ea75575afdb4e87b262641ee4071ef42b4c6 (diff) | |
parent | af9e654045f11028e50dac4781e297834129a749 (diff) | |
download | CMake-cd8e31a1bf7429514078c2923a1a9580113f9d4f.zip CMake-cd8e31a1bf7429514078c2923a1a9580113f9d4f.tar.gz CMake-cd8e31a1bf7429514078c2923a1a9580113f9d4f.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2018-01-23 (d6c21c8e)
Diffstat (limited to 'Utilities/cmcurl/lib/conncache.h')
-rw-r--r-- | Utilities/cmcurl/lib/conncache.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Utilities/cmcurl/lib/conncache.h b/Utilities/cmcurl/lib/conncache.h index 14be4e8..d8ad80f 100644 --- a/Utilities/cmcurl/lib/conncache.h +++ b/Utilities/cmcurl/lib/conncache.h @@ -23,11 +23,19 @@ * ***************************************************************************/ +/* + * All accesses to struct fields and changing of data in the connection cache + * and connectbundles must be done with the conncache LOCKED. The cache might + * be shared. + */ + struct conncache { struct curl_hash hash; - size_t num_connections; + size_t num_conn; long next_connection_id; struct curltime last_cleanup; + /* handle used for closing cached connections */ + struct Curl_easy *closure_handle; }; #define BUNDLE_NO_MULTIUSE -1 @@ -41,21 +49,25 @@ struct connectbundle { struct curl_llist conn_list; /* The connectdata members of the bundle */ }; +/* returns 1 on error, 0 is fine */ int Curl_conncache_init(struct conncache *, int size); - void Curl_conncache_destroy(struct conncache *connc); /* return the correct bundle, to a host or a proxy */ struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn, struct conncache *connc); +void Curl_conncache_unlock(struct connectdata *conn); +/* returns number of connections currently held in the connection cache */ +size_t Curl_conncache_size(struct Curl_easy *data); +size_t Curl_conncache_bundle_size(struct connectdata *conn); +bool Curl_conncache_return_conn(struct connectdata *conn); CURLcode Curl_conncache_add_conn(struct conncache *connc, struct connectdata *conn); - -void Curl_conncache_remove_conn(struct conncache *connc, - struct connectdata *conn); - -void Curl_conncache_foreach(struct conncache *connc, +void Curl_conncache_remove_conn(struct connectdata *conn, + bool lock); +bool Curl_conncache_foreach(struct Curl_easy *data, + struct conncache *connc, void *param, int (*func)(struct connectdata *conn, void *param)); @@ -63,6 +75,12 @@ void Curl_conncache_foreach(struct conncache *connc, struct connectdata * Curl_conncache_find_first_connection(struct conncache *connc); +struct connectdata * +Curl_conncache_extract_bundle(struct Curl_easy *data, + struct connectbundle *bundle); +struct connectdata * +Curl_conncache_extract_oldest(struct Curl_easy *data); +void Curl_conncache_close_all_connections(struct conncache *connc); void Curl_conncache_print(struct conncache *connc); #endif /* HEADER_CURL_CONNCACHE_H */ |