mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
http: a stream hash for h2 multiplexing
This commit is contained in:
parent
7957d2eb92
commit
77f1029ecd
22
lib/http2.c
22
lib/http2.c
@ -564,6 +564,11 @@ static nghttp2_settings_entry settings[] = {
|
|||||||
|
|
||||||
#define H2_BUFSIZE 4096
|
#define H2_BUFSIZE 4096
|
||||||
|
|
||||||
|
static void freestreamentry(void *freethis)
|
||||||
|
{
|
||||||
|
(void)freethis;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize nghttp2 for a Curl connection
|
* Initialize nghttp2 for a Curl connection
|
||||||
*/
|
*/
|
||||||
@ -625,9 +630,11 @@ CURLcode Curl_http2_init(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rc = Curl_hash_init(&conn->proto.httpc.streamsh, 7, Curl_hash_str,
|
rc = Curl_hash_init(&conn->proto.httpc.streamsh, 7, Curl_hash_str,
|
||||||
Curl_str_key_compare, NULL);
|
Curl_str_key_compare, freestreamentry);
|
||||||
if(rc)
|
if(rc) {
|
||||||
|
failf(conn->data, "Couldn't init stream hash!");
|
||||||
return CURLE_OUT_OF_MEMORY; /* most likely at least */
|
return CURLE_OUT_OF_MEMORY; /* most likely at least */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
@ -965,9 +972,18 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
infof(conn->data, "Using Stream ID: %x\n", stream_id);
|
infof(conn->data, "Using Stream ID: %x (easy handle %p)\n",
|
||||||
|
stream_id, conn->data);
|
||||||
stream->stream_id = stream_id;
|
stream->stream_id = stream_id;
|
||||||
|
|
||||||
|
/* put the SessionHandle in the hash with the stream_id as key */
|
||||||
|
if(!Curl_hash_add(&httpc->streamsh, &stream->stream_id, sizeof(stream_id),
|
||||||
|
conn->data)) {
|
||||||
|
failf(conn->data, "Couldn't add stream to hash!");
|
||||||
|
*err = CURLE_OUT_OF_MEMORY;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
rv = nghttp2_session_send(httpc->h2);
|
rv = nghttp2_session_send(httpc->h2);
|
||||||
|
|
||||||
if(rv != 0) {
|
if(rv != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user