Wrap longer lines (> 80)

This commit is contained in:
Tatsuhiro Tsujikawa 2014-08-25 22:41:34 +09:00
parent 0b1ab90fb8
commit 565c635e9b
1 changed files with 34 additions and 19 deletions

View File

@ -1323,21 +1323,23 @@ static int nghttp2_session_predicate_settings_send(nghttp2_session *session,
return 0;
}
/* Take into account settings max frame size and both connection-level flow control here */
static ssize_t nghttp2_session_enforce_flow_control_limits(nghttp2_session *session,
/* Take into account settings max frame size and both connection-level
flow control here */
static ssize_t nghttp2_session_enforce_flow_control_limits
(nghttp2_session *session,
nghttp2_stream *stream,
ssize_t requested_window_size)
{
DEBUGF(fprintf(stderr,
"send: remote windowsize connection=%d, remote maxframsize=%u, "
"stream(id %d)=%d\n",
"send: remote windowsize connection=%d, "
"remote maxframsize=%u, stream(id %d)=%d\n",
session->remote_window_size,
session->remote_settings.max_frame_size,
stream->stream_id,
stream->remote_window_size));
return nghttp2_min(
nghttp2_min(nghttp2_min(requested_window_size, stream->remote_window_size),
return nghttp2_min(nghttp2_min(nghttp2_min(requested_window_size,
stream->remote_window_size),
session->remote_window_size),
session->remote_settings.max_frame_size);
}
@ -1351,9 +1353,10 @@ static ssize_t nghttp2_session_enforce_flow_control_limits(nghttp2_session *sess
static size_t nghttp2_session_next_data_read(nghttp2_session *session,
nghttp2_stream *stream)
{
ssize_t window_size = nghttp2_session_enforce_flow_control_limits(session,
stream,
NGHTTP2_DATA_PAYLOADLEN);
ssize_t window_size;
window_size = nghttp2_session_enforce_flow_control_limits
(session, stream, NGHTTP2_DATA_PAYLOADLEN);
DEBUGF(fprintf(stderr, "send: available window=%zd\n", window_size));
@ -1422,7 +1425,8 @@ static ssize_t session_call_select_padding(nghttp2_session *session,
if(session->callbacks.select_padding_callback) {
size_t max_paddedlen;
max_paddedlen = nghttp2_min(frame->hd.length + NGHTTP2_MAX_PADLEN, max_payloadlen);
max_paddedlen = nghttp2_min(frame->hd.length + NGHTTP2_MAX_PADLEN,
max_payloadlen);
rv = session->callbacks.select_padding_callback(session, frame,
max_paddedlen,
@ -1451,7 +1455,8 @@ static int session_headers_add_pad(nghttp2_session *session,
aob = &session->aob;
framebufs = &aob->framebufs;
max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN, frame->hd.length + NGHTTP2_MAX_PADLEN);
max_payloadlen = nghttp2_min(NGHTTP2_MAX_PAYLOADLEN,
frame->hd.length + NGHTTP2_MAX_PADLEN);
padded_payloadlen = session_call_select_padding(session, frame,
max_payloadlen);
@ -5637,7 +5642,9 @@ int nghttp2_session_pack_data(nghttp2_session *session,
buf = &bufs->cur->buf;
if(session->callbacks.read_length_callback) {
nghttp2_stream *stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
nghttp2_stream *stream;
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
if(!stream) {
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
@ -5646,9 +5653,16 @@ int nghttp2_session_pack_data(nghttp2_session *session,
(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));
payloadlen =
nghttp2_session_enforce_flow_control_limits(session, stream, payloadlen);
DEBUGF(fprintf(stderr,
"send: read_length_callback after flow control=%zd\n",
payloadlen));
if(payloadlen <= 0) {
return NGHTTP2_ERR_CALLBACK_FAILURE;
} else if(payloadlen > nghttp2_buf_avail(buf)) {
@ -5710,7 +5724,8 @@ int nghttp2_session_pack_data(nghttp2_session *session,
data_frame.hd.flags = flags;
data_frame.data.padlen = 0;
max_payloadlen = nghttp2_min(datamax, data_frame.hd.length + NGHTTP2_MAX_PADLEN);
max_payloadlen = nghttp2_min(datamax,
data_frame.hd.length + NGHTTP2_MAX_PADLEN);
padded_payloadlen = session_call_select_padding(session, &data_frame,
max_payloadlen);