Tear down connection if SETTINGS makes window size overflow

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-14 16:08:39 +09:00
parent e74fbdf6b4
commit 7ab4206269
2 changed files with 8 additions and 5 deletions

View File

@ -2562,8 +2562,8 @@ static int nghttp2_update_remote_initial_window_size_func
arg->new_window_size, arg->new_window_size,
arg->old_window_size); arg->old_window_size);
if(rv != 0) { if(rv != 0) {
return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, return nghttp2_session_terminate_session(arg->session,
NGHTTP2_FLOW_CONTROL_ERROR); NGHTTP2_FLOW_CONTROL_ERROR);
} }
/* If window size gets positive, push deferred DATA frame to /* If window size gets positive, push deferred DATA frame to
outbound queue. */ outbound queue. */
@ -2619,8 +2619,8 @@ static int nghttp2_update_local_initial_window_size_func
arg->new_window_size, arg->new_window_size,
arg->old_window_size); arg->old_window_size);
if(rv != 0) { if(rv != 0) {
return nghttp2_session_add_rst_stream(arg->session, stream->stream_id, return nghttp2_session_terminate_session(arg->session,
NGHTTP2_FLOW_CONTROL_ERROR); NGHTTP2_FLOW_CONTROL_ERROR);
} }
if(!(arg->session->opt_flags & if(!(arg->session->opt_flags &
NGHTTP2_OPTMASK_NO_AUTO_STREAM_WINDOW_UPDATE)) { NGHTTP2_OPTMASK_NO_AUTO_STREAM_WINDOW_UPDATE)) {

View File

@ -2791,7 +2791,10 @@ void test_nghttp2_submit_settings_update_local_window_size(void)
CU_ASSERT(0 == nghttp2_session_send(session)); CU_ASSERT(0 == nghttp2_session_send(session));
CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0)); CU_ASSERT(0 == nghttp2_session_on_settings_received(session, &ack_frame, 0));
CU_ASSERT(NGHTTP2_STREAM_CLOSING == stream->state);
item = nghttp2_session_get_next_ob_item(session);
CU_ASSERT(NGHTTP2_GOAWAY == OB_CTRL_TYPE(item));
CU_ASSERT(NGHTTP2_FLOW_CONTROL_ERROR == OB_CTRL(item)->goaway.error_code);
nghttp2_session_del(session); nghttp2_session_del(session);
nghttp2_frame_settings_free(&ack_frame.settings); nghttp2_frame_settings_free(&ack_frame.settings);