Rename SPDY terms

This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-25 21:18:13 +09:00
parent 1056d8690e
commit 48d7453a21
1 changed files with 41 additions and 40 deletions

View File

@ -563,8 +563,8 @@ static int nghttp2_session_predicate_request_headers_send
(nghttp2_session *session, nghttp2_headers *frame) (nghttp2_session *session, nghttp2_headers *frame)
{ {
if(session->goaway_flags) { if(session->goaway_flags) {
/* When GOAWAY is sent or received, peer must not send new /* When GOAWAY is sent or received, peer must not send new request
SYN_STREAM. */ HEADERS. */
return NGHTTP2_ERR_START_STREAM_NOT_ALLOWED; return NGHTTP2_ERR_START_STREAM_NOT_ALLOWED;
} }
/* All 32bit signed stream IDs are spent. */ /* All 32bit signed stream IDs are spent. */
@ -585,14 +585,13 @@ static int nghttp2_session_predicate_request_headers_send
* The stream is already closed or does not exist. * The stream is already closed or does not exist.
* NGHTTP2_ERR_STREAM_SHUT_WR * NGHTTP2_ERR_STREAM_SHUT_WR
* The transmission is not allowed for this stream (e.g., a frame * The transmission is not allowed for this stream (e.g., a frame
* with FIN flag set has already sent) * with END_STREAM flag set has already sent)
* NGHTTP2_ERR_INVALID_STREAM_ID * NGHTTP2_ERR_INVALID_STREAM_ID
* The stream ID is invalid. * The stream ID is invalid.
* NGHTTP2_ERR_STREAM_CLOSING * NGHTTP2_ERR_STREAM_CLOSING
* RST_STREAM was queued for this stream. * RST_STREAM was queued for this stream.
* NGHTTP2_ERR_INVALID_STREAM_STATE * NGHTTP2_ERR_INVALID_STREAM_STATE
* The state of the stream is not valid (e.g., SYN_REPLY has * The state of the stream is not valid.
* already sent).
*/ */
static int nghttp2_session_predicate_response_headers_send static int nghttp2_session_predicate_response_headers_send
(nghttp2_session *session, int32_t stream_id) (nghttp2_session *session, int32_t stream_id)
@ -664,12 +663,11 @@ static int nghttp2_session_predicate_push_response_headers_send
* The stream is already closed or does not exist. * The stream is already closed or does not exist.
* NGHTTP2_ERR_STREAM_SHUT_WR * NGHTTP2_ERR_STREAM_SHUT_WR
* The transmission is not allowed for this stream (e.g., a frame * The transmission is not allowed for this stream (e.g., a frame
* with FIN flag set has already sent) * with END_STREAM flag set has already sent)
* NGHTTP2_ERR_STREAM_CLOSING * NGHTTP2_ERR_STREAM_CLOSING
* RST_STREAM was queued for this stream. * RST_STREAM was queued for this stream.
* NGHTTP2_ERR_INVALID_STREAM_STATE * NGHTTP2_ERR_INVALID_STREAM_STATE
* The state of the stream is not valid (e.g., if the local peer * The state of the stream is not valid.
* is receiving side and SYN_REPLY has not been sent).
*/ */
static int nghttp2_session_predicate_stream_frame_send static int nghttp2_session_predicate_stream_frame_send
(nghttp2_session* session, int32_t stream_id) (nghttp2_session* session, int32_t stream_id)
@ -774,8 +772,8 @@ static int nghttp2_session_predicate_push_promise_send
/* /*
* This function checks WINDOW_UPDATE with the stream ID |stream_id| * This function checks WINDOW_UPDATE with the stream ID |stream_id|
* can be sent at this time. Note that FIN flag of the previous frame * can be sent at this time. Note that END_STREAM flag of the previous
* does not affect the transmission of the WINDOW_UPDATE frame. * frame does not affect the transmission of the WINDOW_UPDATE frame.
* *
* This function returns 0 if it succeeds, or one of the following * This function returns 0 if it succeeds, or one of the following
* negative error codes: * negative error codes:
@ -843,14 +841,13 @@ static size_t nghttp2_session_next_data_read(nghttp2_session *session,
* The stream is already closed or does not exist. * The stream is already closed or does not exist.
* NGHTTP2_ERR_STREAM_SHUT_WR * NGHTTP2_ERR_STREAM_SHUT_WR
* The transmission is not allowed for this stream (e.g., a frame * The transmission is not allowed for this stream (e.g., a frame
* with FIN flag set has already sent) * with END_STREAM flag set has already sent)
* NGHTTP2_ERR_DEFERRED_DATA_EXIST * NGHTTP2_ERR_DEFERRED_DATA_EXIST
* Another DATA frame has already been deferred. * Another DATA frame has already been deferred.
* NGHTTP2_ERR_STREAM_CLOSING * NGHTTP2_ERR_STREAM_CLOSING
* RST_STREAM was queued for this stream. * RST_STREAM was queued for this stream.
* NGHTTP2_ERR_INVALID_STREAM_STATE * NGHTTP2_ERR_INVALID_STREAM_STATE
* The state of the stream is not valid (e.g., if the local peer * The state of the stream is not valid.
* is receiving side and SYN_REPLY has not been sent).
*/ */
static int nghttp2_session_predicate_data_send(nghttp2_session *session, static int nghttp2_session_predicate_data_send(nghttp2_session *session,
int32_t stream_id) int32_t stream_id)
@ -1136,16 +1133,16 @@ nghttp2_outbound_item* nghttp2_session_get_next_ob_item
if(nghttp2_pq_empty(&session->ob_ss_pq)) { if(nghttp2_pq_empty(&session->ob_ss_pq)) {
return nghttp2_pq_top(&session->ob_pq); return nghttp2_pq_top(&session->ob_pq);
} else { } else {
nghttp2_outbound_item *item, *syn_stream_item; nghttp2_outbound_item *item, *headers_item;
item = nghttp2_pq_top(&session->ob_pq); item = nghttp2_pq_top(&session->ob_pq);
syn_stream_item = nghttp2_pq_top(&session->ob_ss_pq); headers_item = nghttp2_pq_top(&session->ob_ss_pq);
if(nghttp2_session_is_outgoing_concurrent_streams_max(session) || if(nghttp2_session_is_outgoing_concurrent_streams_max(session) ||
item->pri < syn_stream_item->pri || item->pri < headers_item->pri ||
(item->pri == syn_stream_item->pri && (item->pri == headers_item->pri &&
item->seq < syn_stream_item->seq)) { item->seq < headers_item->seq)) {
return item; return item;
} else { } else {
return syn_stream_item; return headers_item;
} }
} }
} }
@ -1176,18 +1173,18 @@ nghttp2_outbound_item* nghttp2_session_pop_next_ob_item
nghttp2_pq_pop(&session->ob_pq); nghttp2_pq_pop(&session->ob_pq);
return item; return item;
} else { } else {
nghttp2_outbound_item *item, *syn_stream_item; nghttp2_outbound_item *item, *headers_item;
item = nghttp2_pq_top(&session->ob_pq); item = nghttp2_pq_top(&session->ob_pq);
syn_stream_item = nghttp2_pq_top(&session->ob_ss_pq); headers_item = nghttp2_pq_top(&session->ob_ss_pq);
if(nghttp2_session_is_outgoing_concurrent_streams_max(session) || if(nghttp2_session_is_outgoing_concurrent_streams_max(session) ||
item->pri < syn_stream_item->pri || item->pri < headers_item->pri ||
(item->pri == syn_stream_item->pri && (item->pri == headers_item->pri &&
item->seq < syn_stream_item->seq)) { item->seq < headers_item->seq)) {
nghttp2_pq_pop(&session->ob_pq); nghttp2_pq_pop(&session->ob_pq);
return item; return item;
} else { } else {
nghttp2_pq_pop(&session->ob_ss_pq); nghttp2_pq_pop(&session->ob_ss_pq);
return syn_stream_item; return headers_item;
} }
} }
} }
@ -1586,12 +1583,15 @@ static int nghttp2_session_is_new_peer_stream_id(nghttp2_session *session,
} }
/* /*
* Validates received HEADERS frame |frame| with * Validates received HEADERS frame |frame| with NGHTTP2_HCAT_REQUEST
* NGHTTP2_HCAT_REQUEST category_. This function returns 0 if it * or NGHTTP2_HCAT_PUSH_RESPONSE category, which both opens new
* succeeds, or non-zero nghttp2_error_code. * stream.
*
* This function returns 0 if it succeeds, or non-zero
* nghttp2_error_code.
*/ */
static int nghttp2_session_validate_syn_stream(nghttp2_session *session, static int nghttp2_session_validate_request_headers(nghttp2_session *session,
nghttp2_headers *frame) nghttp2_headers *frame)
{ {
if(nghttp2_session_is_incoming_concurrent_streams_max(session)) { if(nghttp2_session_is_incoming_concurrent_streams_max(session)) {
/* The spec does not clearly say what to do when max concurrent /* The spec does not clearly say what to do when max concurrent
@ -1675,7 +1675,8 @@ int nghttp2_session_on_request_headers_received(nghttp2_session *session,
(session, frame, NGHTTP2_PROTOCOL_ERROR); (session, frame, NGHTTP2_PROTOCOL_ERROR);
} else { } else {
session->last_recv_stream_id = frame->hd.stream_id; session->last_recv_stream_id = frame->hd.stream_id;
error_code = nghttp2_session_validate_syn_stream(session, &frame->headers); error_code = nghttp2_session_validate_request_headers
(session, &frame->headers);
} }
if(error_code == 0) { if(error_code == 0) {
uint8_t flags = frame->hd.flags; uint8_t flags = frame->hd.flags;
@ -1750,7 +1751,7 @@ int nghttp2_session_on_push_response_headers_received(nghttp2_session *session,
/* We don't accept new stream after GOAWAY is sent or received. */ /* We don't accept new stream after GOAWAY is sent or received. */
return 0; return 0;
} }
rv = nghttp2_session_validate_syn_stream(session, &frame->headers); rv = nghttp2_session_validate_request_headers(session, &frame->headers);
if(rv != 0) { if(rv != 0) {
return nghttp2_session_handle_invalid_stream(session, frame, rv); return nghttp2_session_handle_invalid_stream(session, frame, rv);
} }
@ -1788,7 +1789,7 @@ int nghttp2_session_on_headers_received(nghttp2_session *session,
} }
} else { } else {
/* If this is remote peer initiated stream, it is OK unless it /* If this is remote peer initiated stream, it is OK unless it
have sent FIN frame already. But if stream is in has sent END_STREAM frame already. But if stream is in
NGHTTP2_STREAM_CLOSING, we discard the frame. This is a race NGHTTP2_STREAM_CLOSING, we discard the frame. This is a race
condition. */ condition. */
valid = 1; valid = 1;
@ -2460,8 +2461,8 @@ int nghttp2_session_on_data_received(nghttp2_session *session,
} }
} else if(stream->state != NGHTTP2_STREAM_CLOSING) { } else if(stream->state != NGHTTP2_STREAM_CLOSING) {
/* It is OK if this is remote peer initiated stream and we did /* It is OK if this is remote peer initiated stream and we did
not receive FIN unless stream is in NGHTTP2_STREAM_CLOSING not receive END_STREAM unless stream is in
state. This is a race condition. */ NGHTTP2_STREAM_CLOSING state. This is a race condition. */
valid = 1; valid = 1;
if(session->callbacks.on_data_recv_callback) { if(session->callbacks.on_data_recv_callback) {
session->callbacks.on_data_recv_callback session->callbacks.on_data_recv_callback
@ -2603,8 +2604,8 @@ static int nghttp2_session_check_data_recv_allowed(nghttp2_session *session,
} }
} else if(stream->state != NGHTTP2_STREAM_CLOSING) { } else if(stream->state != NGHTTP2_STREAM_CLOSING) {
/* It is OK if this is remote peer initiated stream and we did /* It is OK if this is remote peer initiated stream and we did
not receive FIN unless stream is in NGHTTP2_STREAM_CLOSING not receive END_STREAM unless stream is in
state. This is a race condition. */ NGHTTP2_STREAM_CLOSING state. This is a race condition. */
return 1; return 1;
} }
} }
@ -2782,9 +2783,9 @@ int nghttp2_session_want_write(nghttp2_session *session)
} }
/* /*
* Unless GOAWAY is sent or received, we want to write frames if * Unless GOAWAY is sent or received, we want to write frames if
* there is pending ones. If pending frame is SYN_STREAM and * there is pending ones. If pending frame is request/push response
* concurrent stream limit is reached, we don't want to write * HEADERS and concurrent stream limit is reached, we don't want to
* SYN_STREAM. After GOAWAY is sent or received, we want to write * write them. After GOAWAY is sent or received, we want to write
* frames if there is pending ones AND there are active frames. * frames if there is pending ones AND there are active frames.
*/ */
return (session->aob.item != NULL || !nghttp2_pq_empty(&session->ob_pq) || return (session->aob.item != NULL || !nghttp2_pq_empty(&session->ob_pq) ||