From 0b1ab90fb8c67e1421ee728663a026660135820f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 25 Aug 2014 22:31:11 +0900 Subject: [PATCH] Move frame_type parameter in front of stream_id This commit moves frame_type parameter of nghttp2_data_soruce_read_length_callback in front of stream_id parameter. The motivation is that other callback is generally put frame related parameters first. To make it consistent, we move frame_type, which is frame ralted parameter, to the left. --- lib/includes/nghttp2/nghttp2.h | 3 +-- lib/nghttp2_session.c | 7 ++++--- tests/nghttp2_session_test.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index e83265f6..637b1648 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -1444,11 +1444,10 @@ typedef ssize_t (*nghttp2_select_padding_callback) * `nghttp2_session_callbacks_set_data_source_read_length_callback()`. */ typedef ssize_t (*nghttp2_data_source_read_length_callback) -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session, uint8_t frame_type, int32_t stream_id, int32_t session_remote_window_size, int32_t stream_remote_window_size, uint32_t remote_max_frame_size, - uint8_t frame_type, void *user_data); /** diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 86b12ce6..382c6044 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -5642,9 +5642,10 @@ int nghttp2_session_pack_data(nghttp2_session *session, return NGHTTP2_ERR_INVALID_ARGUMENT; } - payloadlen = session->callbacks.read_length_callback(session, stream->stream_id, - session->remote_window_size, stream->remote_window_size, - session->remote_settings.max_frame_size, frame->hd.type, session->user_data); + payloadlen = session->callbacks.read_length_callback + (session, frame->hd.type, stream->stream_id, + session->remote_window_size, stream->remote_window_size, + session->remote_settings.max_frame_size, session->user_data); DEBUGF(fprintf(stderr, "send: read_length_callback=%zd\n", payloadlen)); payloadlen = nghttp2_session_enforce_flow_control_limits(session, stream, payloadlen); DEBUGF(fprintf(stderr, "send: read_length_callback after flow control=%zd\n", payloadlen)); diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index d6894d79..db5ccb55 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -239,16 +239,16 @@ static ssize_t select_padding_callback(nghttp2_session *session, } static ssize_t too_large_data_source_length_callback -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session, uint8_t frame_type, int32_t stream_id, int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, uint8_t frame_type, void *user_data) { + uint32_t remote_max_frame_size, void *user_data) { return NGHTTP2_MAX_FRAME_SIZE_MAX + 1; } static ssize_t smallest_length_data_source_length_callback -(nghttp2_session *session, int32_t stream_id, +(nghttp2_session *session, uint8_t frame_type, int32_t stream_id, int32_t session_remote_window_size, int32_t stream_remote_window_size, - uint32_t remote_max_frame_size, uint8_t frame_type, void *user_data) { + uint32_t remote_max_frame_size, void *user_data) { return 1; }