Disable local flow control in nghttp2_submit_window_update()

This commit is contained in:
Tatsuhiro Tsujikawa 2013-08-09 23:46:12 +09:00
parent 1155606d5e
commit 80bacd0a54
2 changed files with 11 additions and 13 deletions

View File

@ -1336,17 +1336,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
session->goaway_flags |= NGHTTP2_GOAWAY_SEND; session->goaway_flags |= NGHTTP2_GOAWAY_SEND;
break; break;
case NGHTTP2_WINDOW_UPDATE: case NGHTTP2_WINDOW_UPDATE:
if(frame->hd.flags & NGHTTP2_FLAG_END_FLOW_CONTROL) { /* nothing to do */
if(frame->hd.stream_id == 0) {
session->local_flow_control = 0;
} else {
nghttp2_stream *stream;
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
if(stream) {
stream->local_flow_control = 0;
}
}
}
break; break;
} }
nghttp2_active_outbound_item_reset(&session->aob); nghttp2_active_outbound_item_reset(&session->aob);

View File

@ -234,7 +234,15 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
nghttp2_stream *stream; nghttp2_stream *stream;
flags &= NGHTTP2_FLAG_END_FLOW_CONTROL; flags &= NGHTTP2_FLAG_END_FLOW_CONTROL;
if(flags & NGHTTP2_FLAG_END_FLOW_CONTROL) { if(flags & NGHTTP2_FLAG_END_FLOW_CONTROL) {
window_size_increment = 0; if(stream_id == 0) {
session->local_flow_control = 0;
} else {
stream = nghttp2_session_get_stream(session, stream_id);
if(stream) {
stream->local_flow_control = 0;
}
}
return nghttp2_session_add_window_update(session, flags, stream_id, 0);
} else if(window_size_increment == 0) { } else if(window_size_increment == 0) {
return NGHTTP2_ERR_INVALID_ARGUMENT; return NGHTTP2_ERR_INVALID_ARGUMENT;
} }
@ -280,7 +288,7 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags,
return NGHTTP2_ERR_STREAM_CLOSED; return NGHTTP2_ERR_STREAM_CLOSED;
} }
} }
if(window_size_increment > 0 || (flags & NGHTTP2_FLAG_END_FLOW_CONTROL)) { if(window_size_increment > 0) {
return nghttp2_session_add_window_update(session, flags, stream_id, return nghttp2_session_add_window_update(session, flags, stream_id,
window_size_increment); window_size_increment);
} }