Change nghttp2_session_get_stream_remote_window_size behavior

Now it returns only stream's available remote window size, without
considering connection level window size.  For connection-level window
size, nghttp2_session_get_remote_window_size() is added by this
commit.  To get old behavior of
nghttp2_session_get_stream_remote_window_size() is use
min(nghttp2_session_get_stream_remote_window_size(),
nghttp2_session_get_remote_window_size()).  The reason of this change
is that it is desirable to know just stream level window size without
taking into connection level window size.  This is useful for
debugging purpose.
This commit is contained in:
Tatsuhiro Tsujikawa
2014-08-23 18:41:34 +09:00
parent 03ed29953e
commit 82bc7198e6
4 changed files with 35 additions and 6 deletions

View File

@@ -5812,8 +5812,8 @@ int32_t nghttp2_session_get_effective_local_window_size
return session->local_window_size;
}
int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session* session,
int32_t stream_id)
int32_t nghttp2_session_get_stream_remote_window_size
(nghttp2_session *session, int32_t stream_id)
{
nghttp2_stream *stream;
@@ -5822,7 +5822,14 @@ int32_t nghttp2_session_get_stream_remote_window_size(nghttp2_session* session,
return -1;
}
return (int32_t)nghttp2_session_next_data_read(session, stream);
/* stream->remote_window_size can be negative when
SETTINGS_INITIAL_WINDOW_SIZE is changed. */
return nghttp2_max(0, stream->remote_window_size);
}
int32_t nghttp2_session_get_remote_window_size(nghttp2_session *session)
{
return session->remote_window_size;
}
uint32_t nghttp2_session_get_remote_settings(nghttp2_session *session,