mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
Introducing a new persistent connection caching system using "bundles".
A bundle is a list of all persistent connections to the same host. The connection cache consists of a hash of bundles, with the hostname as the key. The benefits may not be obvious, but they are two: 1) Faster search for connections to reuse, since the hash lookup only finds connections to the host in question. 2) It lays out the groundworks for an upcoming patch, which will introduce multiple HTTP pipelines. This patch also removes the awkward list of "closure handles", which were needed to send QUIT commands to the FTP server when closing a connection. Now we allocate a separate closure handle and use that one to close all connections. This has been tested in a live system for a few weeks, and of course passes the test suite.
This commit is contained in:
parent
ca5f4e2135
commit
d021f2e8a0
14 changed files with 894 additions and 773 deletions
14
lib/hash.h
14
lib/hash.h
|
|
@ -62,6 +62,11 @@ struct curl_hash_element {
|
|||
size_t key_len;
|
||||
};
|
||||
|
||||
struct curl_hash_iterator {
|
||||
struct curl_hash *hash;
|
||||
int slot_index;
|
||||
struct curl_llist_element *current_element;
|
||||
};
|
||||
|
||||
int Curl_hash_init(struct curl_hash *h,
|
||||
int slots,
|
||||
|
|
@ -89,4 +94,13 @@ size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num);
|
|||
size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2,
|
||||
size_t key2_len);
|
||||
|
||||
void Curl_hash_start_iterate(struct curl_hash *hash,
|
||||
struct curl_hash_iterator *iter);
|
||||
struct curl_hash_element *
|
||||
Curl_hash_next_element(struct curl_hash_iterator *iter);
|
||||
|
||||
void Curl_hash_print(struct curl_hash *h,
|
||||
void (*func)(void *));
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue