Take into account that pending_local_max_concurrent_stream could be too large

pending_local_max_concurrent_stream is, once local settings applied,
becomes NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS, which is very large
number.  When adjusting number of streams, we have to take min of
local effective SETTINGS_MAX_CONCURRENT_STREAMS and pending one.
This commit is contained in:
Tatsuhiro Tsujikawa 2014-05-16 22:32:08 +09:00
parent 2778e4aafc
commit 1ac028e166
1 changed files with 9 additions and 2 deletions

View File

@ -889,15 +889,22 @@ void nghttp2_session_keep_closed_stream(nghttp2_session *session,
void nghttp2_session_adjust_closed_stream(nghttp2_session *session,
ssize_t offset)
{
size_t num_stream_max;
num_stream_max =
nghttp2_min
(session->local_settings[NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS],
session->pending_local_max_concurrent_stream);
DEBUGF(fprintf(stderr, "stream: adjusting kept closed streams "
"num_closed_streams=%zu, num_incoming_streams=%zu, "
"max_concurrent_streams=%u\n",
session->num_closed_streams, session->num_incoming_streams,
session->pending_local_max_concurrent_stream));
num_stream_max));
while(session->num_closed_streams > 0 &&
session->num_closed_streams + session->num_incoming_streams + offset
> session->pending_local_max_concurrent_stream) {
> num_stream_max) {
nghttp2_stream *head_stream;
head_stream = session->closed_stream_head;