From 80bacd0a5480058bccf028e4691026161efbbdac Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 9 Aug 2013 23:46:12 +0900 Subject: [PATCH] Disable local flow control in nghttp2_submit_window_update() --- lib/nghttp2_session.c | 12 +----------- lib/nghttp2_submit.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 1b6e12fd..e7dfd19e 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -1336,17 +1336,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session) session->goaway_flags |= NGHTTP2_GOAWAY_SEND; break; case NGHTTP2_WINDOW_UPDATE: - if(frame->hd.flags & NGHTTP2_FLAG_END_FLOW_CONTROL) { - 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; - } - } - } + /* nothing to do */ break; } nghttp2_active_outbound_item_reset(&session->aob); diff --git a/lib/nghttp2_submit.c b/lib/nghttp2_submit.c index 0c97f00a..34b2307b 100644 --- a/lib/nghttp2_submit.c +++ b/lib/nghttp2_submit.c @@ -234,7 +234,15 @@ int nghttp2_submit_window_update(nghttp2_session *session, uint8_t flags, nghttp2_stream *stream; 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) { 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; } } - 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, window_size_increment); }