CURLMOPT_MAX_CONCURRENT_STREAMS: new setopt

Closes #4410
This commit is contained in:
Kunal Ekawde 2019-09-24 08:56:11 -04:00 committed by Daniel Stenberg
parent f0f053fed0
commit c124e6b3c0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
10 changed files with 97 additions and 6 deletions

View file

@ -2772,6 +2772,16 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi,
break;
case CURLMOPT_PIPELINING_SERVER_BL:
break;
case CURLMOPT_MAX_CONCURRENT_STREAMS:
{
long streams = va_arg(param, long);
if(streams < 1)
streams = 100;
multi->max_concurrent_streams =
(streams > (long)INITIAL_MAX_CONCURRENT_STREAMS)?
(long)INITIAL_MAX_CONCURRENT_STREAMS : streams;
}
break;
default:
res = CURLM_UNKNOWN_OPTION;
break;
@ -3210,3 +3220,9 @@ void Curl_multi_dump(struct Curl_multi *multi)
}
}
#endif
size_t Curl_multi_max_concurrent_streams(struct Curl_multi *multi)
{
return multi ? ((size_t)multi->max_concurrent_streams ?
(size_t)multi->max_concurrent_streams : 100) : 0;
}