Skip to content
Permalink
Browse files

update to max concurrent streams API

  • Loading branch information...
kunal_ekawde
kunal_ekawde committed May 15, 2019
1 parent e451d9c commit b3321ba734e381817b393a65f80dc2fd6806a002
@@ -203,7 +203,7 @@ int main(int argc, char **argv)
curl_multi_add_handle(multi_handle, trans[i].easy);
}

curl_multi_setopt(multi_handle, CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS, 100L);
curl_multi_setopt(multi_handle, CURLMOPT_MAX_CONCURRENT_STREAMS, 120L);

curl_multi_setopt(multi_handle, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);

@@ -67,8 +67,8 @@ See \fICURLMOPT_SOCKETDATA(3)\fP
See \fICURLMOPT_TIMERFUNCTION(3)\fP
.IP CURLMOPT_TIMERDATA
See \fICURLMOPT_TIMERDATA(3)\fP
.IP CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS
See \fICURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS(3)\fP
.IP CURLMOPT_MAX_CONCURRENT_STREAMS
See \fICURLMOPT_MAX_CONCURRENT_STREAMS(3)\fP
.SH RETURNS
The standard CURLMcode for multi interface error codes. Note that it returns a
CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl
@@ -20,18 +20,18 @@
.\" *
.\" **************************************************************************
.\"
.TH CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS 3 "25 Apr 2019" "libcurl 7.64.0" "curl_multi_setopt options"
.TH CURLMOPT_MAX_CONCURRENT_STREAMS 3 "14 May 2019" "libcurl 7.64.0" "curl_multi_setopt options"
.SH NAME
CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS \- set max concurrent streams for http2
CURLMOPT_MAX_CONCURRENT_STREAMS \- set max concurrent streams for http2
.SH SYNOPSIS
#include <curl/curl.h>

CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS, long max);
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_CONCURRENT_STREAMS, long max);
.SH DESCRIPTION
Pass a long indicating the \fBmax\fP. The set number will be used as the
maximum number of concurrent streams for a connections that libcurl should
support.

Valid values range from 1 to 2147483647 (2^31 - 1) and defaults to 100.
This option is for the multi handle's use only.


@@ -43,7 +43,7 @@ All
.nf
CURLM *m = curl_multi_init();
/* max concurrent streams 200 */
curl_multi_setopt(m, CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS, 200L);
curl_multi_setopt(m, CURLMOPT_MAX_CONCURRENT_STREAMS, 200L);
.fi
.SH AVAILABILITY
Added in 7.64.3
@@ -348,4 +348,4 @@ man_MANS = \
CURLOPT_XFERINFODATA.3 \
CURLOPT_XFERINFOFUNCTION.3 \
CURLOPT_XOAUTH2_BEARER.3 \
CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS.3
CURLMOPT_MAX_CONCURRENT_STREAMS.3
@@ -318,7 +318,7 @@ CURLMOPT_MAXCONNECTS 7.16.3
CURLMOPT_MAX_HOST_CONNECTIONS 7.30.0
CURLMOPT_MAX_PIPELINE_LENGTH 7.30.0
CURLMOPT_MAX_TOTAL_CONNECTIONS 7.30.0
CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS 7.64.3
CURLMOPT_MAX_CONCURRENT_STREAMS 7.64.3
CURLMOPT_PIPELINING 7.16.0
CURLMOPT_PIPELINING_SERVER_BL 7.30.0
CURLMOPT_PIPELINING_SITE_BL 7.30.0
@@ -383,7 +383,7 @@ typedef enum {
CINIT(PUSHDATA, OBJECTPOINT, 15),

/* maximum number of (pipelining) connections to one host */
CINIT(MAX_HTTP2_CONCURRENT_STREAMS, LONG, 16),
CINIT(MAX_CONCURRENT_STREAMS, LONG, 16),

CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
@@ -1166,7 +1166,7 @@ static void populate_settings(struct connectdata *conn,
nghttp2_settings_entry *iv = httpc->local_settings;

iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
iv[0].value = Curl_multi_max_http2_concurrent_streams(conn->data->multi);
iv[0].value = (uint32_t)Curl_multi_max_concurrent_streams(conn->data->multi);

iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
iv[1].value = HTTP2_HUGE_WINDOW_SIZE;
@@ -31,6 +31,9 @@
from the peer */
#define DEFAULT_MAX_CONCURRENT_STREAMS 13

/* value for MAXIMUM CONCURRENT STREAMS upper limit */
#define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1)

/*
* Store nghttp2 version info in this buffer, Prefix with a space. Return
* total length written.
@@ -2625,8 +2625,12 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi,
break;
case CURLMOPT_PIPELINING_SERVER_BL:
break;
case CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS:
multi->max_http2_concurrent_streams = va_arg(param, uint32_t);
case CURLMOPT_MAX_CONCURRENT_STREAMS:
{
long streams = va_arg(param, long);
multi->max_concurrent_streams = (streams>INITIAL_MAX_CONCURRENT_STREAMS)?
INITIAL_MAX_CONCURRENT_STREAMS : streams;
}
break;
default:
res = CURLM_UNKNOWN_OPTION;
@@ -3047,10 +3051,10 @@ void Curl_multi_dump(struct Curl_multi *multi)
}
#endif

uint32_t Curl_multi_max_http2_concurrent_streams
size_t Curl_multi_max_concurrent_streams
(struct Curl_multi *multi)
{
return multi ?
(multi->max_http2_concurrent_streams?
multi->max_http2_concurrent_streams:100) : 0;
(multi->max_concurrent_streams?
multi->max_concurrent_streams:100) : 0;
}
@@ -133,8 +133,7 @@ struct Curl_multi {
struct curltime timer_lastcall; /* the fixed time for the timeout for the
previous callback */
bool in_callback; /* true while executing a callback */
uint32_t max_http2_concurrent_streams; /*max concurrent streams http2 client
to support*/
long max_concurrent_streams; /*max concurrent streams client to support*/
};

#endif /* HEADER_CURL_MULTIHANDLE_H */
@@ -108,9 +108,9 @@ CURLMcode Curl_multi_wait(struct Curl_multi *multi,
int *ret,
bool *gotsocket); /* if any socket was checked */

/* Return the value of the CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS option
/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option
* If not specified or 0, default would be 100
*/
uint32_t Curl_multi_max_http2_concurrent_streams(struct Curl_multi *multi);
size_t Curl_multi_max_concurrent_streams(struct Curl_multi *multi);

#endif /* HEADER_CURL_MULTIIF_H */
@@ -1821,7 +1821,7 @@
d c 00007
d CURLMOPT_MAX_PIPELINE_LENGTH...
d c 00008
d CURLMOPT_MAX_HTTP2_CONCURRENT_STREAMS...
d CURLMOPT_MAX_CONCURRENT_STREAMS...
d c 00009
d CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE...
d c 30009

0 comments on commit b3321ba

Please sign in to comment.
You can’t perform that action at this time.