nghttp2_session_on_window_update_received: Split into 2 functions

This commit is contained in:
Tatsuhiro Tsujikawa 2013-09-05 23:21:00 +09:00
parent 464f141593
commit 87abc8b951
1 changed files with 72 additions and 59 deletions

View File

@ -2394,11 +2394,10 @@ static int nghttp2_session_push_back_deferred_data(nghttp2_session *session)
nghttp2_push_back_deferred_data_func, session); nghttp2_push_back_deferred_data_func, session);
} }
int nghttp2_session_on_window_update_received(nghttp2_session *session, static int session_on_connection_window_update_received
nghttp2_frame *frame) (nghttp2_session *session, nghttp2_frame *frame)
{ {
int rv; int rv;
if(frame->hd.stream_id == 0) {
/* Handle connection-level flow control */ /* Handle connection-level flow control */
if(session->remote_flow_control == 0) { if(session->remote_flow_control == 0) {
/* Disabling flow control by sending SETTINGS and receiving /* Disabling flow control by sending SETTINGS and receiving
@ -2424,7 +2423,12 @@ int nghttp2_session_on_window_update_received(nghttp2_session *session,
} else { } else {
return 0; return 0;
} }
} else { }
static int session_on_stream_window_update_received
(nghttp2_session *session, nghttp2_frame *frame)
{
int rv;
nghttp2_stream *stream; nghttp2_stream *stream;
stream = nghttp2_session_get_stream(session, frame->hd.stream_id); stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
if(!stream) { if(!stream) {
@ -2459,6 +2463,15 @@ int nghttp2_session_on_window_update_received(nghttp2_session *session,
} }
return nghttp2_session_call_on_frame_received(session, frame); return nghttp2_session_call_on_frame_received(session, frame);
} }
int nghttp2_session_on_window_update_received(nghttp2_session *session,
nghttp2_frame *frame)
{
if(frame->hd.stream_id == 0) {
return session_on_connection_window_update_received(session, frame);
} else {
return session_on_stream_window_update_received(session, frame);
}
} }
static int get_error_code_from_lib_error_code(int lib_error_code) static int get_error_code_from_lib_error_code(int lib_error_code)