Cancel stream if flow control window gets overflow

Previously, we did terminate session, but it did not actually cancel
streams.  Now we just cancel streams in this case.
This commit is contained in:
Tatsuhiro Tsujikawa 2016-01-23 00:24:12 +09:00
parent a964426fbc
commit 4ceb9fd767
2 changed files with 6 additions and 6 deletions

View File

@ -3779,8 +3779,8 @@ static int update_remote_initial_window_size_func(nghttp2_map_entry *entry,
rv = nghttp2_stream_update_remote_initial_window_size(
stream, arg->new_window_size, arg->old_window_size);
if (rv != 0) {
return nghttp2_session_terminate_session(arg->session,
NGHTTP2_FLOW_CONTROL_ERROR);
return nghttp2_session_add_rst_stream(arg->session, stream->stream_id,
NGHTTP2_FLOW_CONTROL_ERROR);
}
/* If window size gets positive, push deferred DATA frame to
@ -3831,8 +3831,8 @@ static int update_local_initial_window_size_func(nghttp2_map_entry *entry,
rv = nghttp2_stream_update_local_initial_window_size(
stream, arg->new_window_size, arg->old_window_size);
if (rv != 0) {
return nghttp2_session_terminate_session(arg->session,
NGHTTP2_FLOW_CONTROL_ERROR);
return nghttp2_session_add_rst_stream(arg->session, stream->stream_id,
NGHTTP2_FLOW_CONTROL_ERROR);
}
if (!(arg->session->opt_flags & NGHTTP2_OPTMASK_NO_AUTO_WINDOW_UPDATE) &&
stream->window_update_queued == 0 &&

View File

@ -4610,8 +4610,8 @@ void test_nghttp2_submit_settings_update_local_window_size(void) {
CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0));
item = nghttp2_session_get_next_ob_item(session);
CU_ASSERT(NGHTTP2_GOAWAY == item->frame.hd.type);
CU_ASSERT(NGHTTP2_FLOW_CONTROL_ERROR == item->frame.goaway.error_code);
CU_ASSERT(NGHTTP2_RST_STREAM == item->frame.hd.type);
CU_ASSERT(NGHTTP2_FLOW_CONTROL_ERROR == item->frame.rst_stream.error_code);
nghttp2_session_del(session);
nghttp2_frame_settings_free(&ack_frame.settings, mem);