summaryrefslogtreecommitdiff
path: root/lib/hash.h
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2012-12-06 12:12:04 +0100
committerDaniel Stenberg <daniel@haxx.se>2012-12-07 10:08:33 +0100
commitd021f2e8a0067fc769652f27afec9024c0d02b3d (patch)
tree563742088b9866a1b8aa42ee7aab4501d72623dd /lib/hash.h
parentca5f4e21357a0b4a55e7a2a0f71e632442723989 (diff)
downloadcurl-d021f2e8a0067fc769652f27afec9024c0d02b3d.tar.gz
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.
Diffstat (limited to 'lib/hash.h')
-rw-r--r--lib/hash.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/hash.h b/lib/hash.h
index 993aaedd2..5f7c2bf56 100644
--- a/lib/hash.h
+++ b/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