mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
http/2, http/3: decouple stream state from easy handle
- add `Curl_hash_offt` as hashmap between a `curl_off_t` and an object. Use this in h2+h3 connection filters to associate `data->id` with the internal stream state. - changed implementations of all affected connection filters - removed `h2_ctx*` and `h3_ctx*` from `struct HTTP` and thus the easy handle - solves the problem of attaching "foreign protocol" easy handles during connection shutdown Test 1616 verifies the new hash functions. Closes #13204
This commit is contained in:
parent
c03556fb18
commit
c6655f7029
14 changed files with 561 additions and 232 deletions
22
lib/hash.c
22
lib/hash.c
|
|
@ -368,3 +368,25 @@ void Curl_hash_print(struct Curl_hash *h,
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void Curl_hash_offt_init(struct Curl_hash *h,
|
||||
unsigned int slots,
|
||||
Curl_hash_dtor dtor)
|
||||
{
|
||||
Curl_hash_init(h, slots, Curl_hash_str, Curl_str_key_compare, dtor);
|
||||
}
|
||||
|
||||
void *Curl_hash_offt_set(struct Curl_hash *h, curl_off_t id, void *elem)
|
||||
{
|
||||
return Curl_hash_add(h, &id, sizeof(id), elem);
|
||||
}
|
||||
|
||||
int Curl_hash_offt_remove(struct Curl_hash *h, curl_off_t id)
|
||||
{
|
||||
return Curl_hash_delete(h, &id, sizeof(id));
|
||||
}
|
||||
|
||||
void *Curl_hash_offt_get(struct Curl_hash *h, curl_off_t id)
|
||||
{
|
||||
return Curl_hash_pick(h, &id, sizeof(id));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue