Rename nghttp2_stream.data_item to nghttp2_stream.item and related functions

Initially, we use nghttp2_stream.data_item to refer only item with
DATA frame.  But recently we use it to refer HEADERS frame as well.
So it is better to call just item rather than data_item.  This applies
to all related functions.
This commit is contained in:
Tatsuhiro Tsujikawa 2014-12-20 19:53:57 +09:00
parent 39eb1e4753
commit 7c0a0c495d
6 changed files with 156 additions and 157 deletions

View File

@ -512,7 +512,7 @@ static int free_streams(nghttp2_map_entry *entry, void *ptr) {
session = (nghttp2_session *)ptr;
mem = &session->mem;
stream = (nghttp2_stream *)entry;
item = stream->data_item;
item = stream->item;
if (item && !item->queued && item != session->aob.item) {
nghttp2_outbound_item_free(item, mem);
@ -549,7 +549,7 @@ void nghttp2_session_del(nghttp2_session *session) {
nghttp2_stream_roots_free(&session->roots);
/* Have to free streams first, so that we can check
stream->data_item->queued */
stream->item->queued */
nghttp2_map_each_free(&session->streams, free_streams, session);
nghttp2_map_free(&session->streams);
@ -733,7 +733,7 @@ int nghttp2_session_add_item(nghttp2_session *session,
item->weight = stream->effective_weight;
item->cycle = session->last_cycle;
rv = nghttp2_stream_attach_data(stream, item, session);
rv = nghttp2_stream_attach_item(stream, item, session);
if (rv != 0) {
return rv;
@ -764,14 +764,14 @@ int nghttp2_session_add_item(nghttp2_session *session,
return NGHTTP2_ERR_STREAM_CLOSED;
}
if (stream->data_item) {
if (stream->item) {
return NGHTTP2_ERR_DATA_EXIST;
}
item->weight = stream->effective_weight;
item->cycle = session->last_cycle;
rv = nghttp2_stream_attach_data(stream, item, session);
rv = nghttp2_stream_attach_item(stream, item, session);
if (rv != 0) {
return rv;
@ -979,12 +979,12 @@ int nghttp2_session_close_stream(nghttp2_session *session, int32_t stream_id,
DEBUGF(fprintf(stderr, "stream: stream(%p)=%d close\n", stream,
stream->stream_id));
if (stream->data_item) {
if (stream->item) {
nghttp2_outbound_item *item;
item = stream->data_item;
item = stream->item;
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (rv != 0) {
return rv;
@ -1709,10 +1709,10 @@ static int session_prep_frame(nghttp2_session *session,
rv = session_predicate_headers_send(session, stream);
if (rv != 0) {
if (stream && stream->data_item == item) {
if (stream && stream->item == item) {
int rv2;
rv2 = nghttp2_stream_detach_data(stream, session);
rv2 = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv2)) {
return rv2;
@ -1880,7 +1880,7 @@ static int session_prep_frame(nghttp2_session *session,
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
if (stream) {
assert(stream->data_item == item);
assert(stream->item == item);
}
rv = nghttp2_session_predicate_data_send(session, stream);
@ -1888,7 +1888,7 @@ static int session_prep_frame(nghttp2_session *session,
if (stream) {
int rv2;
rv2 = nghttp2_stream_detach_data(stream, session);
rv2 = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv2)) {
return rv2;
@ -1907,7 +1907,7 @@ static int session_prep_frame(nghttp2_session *session,
queue when session->remote_window_size > 0 */
assert(session->remote_window_size > 0);
rv = nghttp2_stream_defer_data(
rv = nghttp2_stream_defer_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, session);
if (nghttp2_is_fatal(rv)) {
@ -1923,7 +1923,7 @@ static int session_prep_frame(nghttp2_session *session,
nghttp2_session_pack_data(session, &session->aob.framebufs,
next_readmax, frame, &item->aux_data.data);
if (framerv == NGHTTP2_ERR_DEFERRED) {
rv = nghttp2_stream_defer_data(stream, NGHTTP2_STREAM_FLAG_DEFERRED_USER,
rv = nghttp2_stream_defer_item(stream, NGHTTP2_STREAM_FLAG_DEFERRED_USER,
session);
if (nghttp2_is_fatal(rv)) {
@ -1935,7 +1935,7 @@ static int session_prep_frame(nghttp2_session *session,
return NGHTTP2_ERR_DEFERRED;
}
if (framerv == NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE) {
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
@ -1949,7 +1949,7 @@ static int session_prep_frame(nghttp2_session *session,
return framerv;
}
if (framerv < 0) {
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
@ -2248,8 +2248,8 @@ static int session_after_frame_sent1(nghttp2_session *session) {
break;
}
if (stream->data_item == item) {
rv = nghttp2_stream_detach_data(stream, session);
if (stream->item == item) {
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
@ -2377,14 +2377,14 @@ static int session_after_frame_sent1(nghttp2_session *session) {
}
if (stream && aux_data->eof) {
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
}
/* Call on_frame_send_callback after
nghttp2_stream_detach_data(), so that application can issue
nghttp2_stream_detach_item(), so that application can issue
nghttp2_submit_data() in the callback. */
if (session->callbacks.on_frame_send_callback) {
rv = session_call_on_frame_send(session, frame);
@ -2493,7 +2493,7 @@ static int session_after_frame_sent2(nghttp2_session *session) {
further data. */
if (nghttp2_session_predicate_data_send(session, stream) != 0) {
if (stream) {
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
@ -2537,7 +2537,7 @@ static int session_after_frame_sent2(nghttp2_session *session) {
aob->item->queued = 1;
} else {
rv = nghttp2_stream_defer_data(
rv = nghttp2_stream_defer_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, session);
if (nghttp2_is_fatal(rv)) {
@ -2559,7 +2559,7 @@ static int session_after_frame_sent2(nghttp2_session *session) {
return rv;
}
if (rv == NGHTTP2_ERR_DEFERRED) {
rv = nghttp2_stream_defer_data(
rv = nghttp2_stream_defer_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_USER, session);
if (nghttp2_is_fatal(rv)) {
@ -2582,7 +2582,7 @@ static int session_after_frame_sent2(nghttp2_session *session) {
return rv;
}
rv = nghttp2_stream_detach_data(stream, session);
rv = nghttp2_stream_detach_item(stream, session);
if (nghttp2_is_fatal(rv)) {
return rv;
@ -2647,7 +2647,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session,
frame = &item->frame;
stream = nghttp2_session_get_stream(session, frame->hd.stream_id);
if (stream && item == stream->data_item &&
if (stream && item == stream->item &&
stream->dpri != NGHTTP2_STREAM_DPRI_TOP) {
/* We have DATA with higher priority in queue within the
same dependency tree. */
@ -3531,7 +3531,7 @@ static int update_remote_initial_window_size_func(nghttp2_map_entry *entry,
if (stream->remote_window_size > 0 &&
nghttp2_stream_check_deferred_by_flow_control(stream)) {
rv = nghttp2_stream_resume_deferred_data(
rv = nghttp2_stream_resume_deferred_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, arg->session);
if (nghttp2_is_fatal(rv)) {
@ -4111,7 +4111,7 @@ static int session_on_stream_window_update_received(nghttp2_session *session,
if (stream->remote_window_size > 0 &&
nghttp2_stream_check_deferred_by_flow_control(stream)) {
rv = nghttp2_stream_resume_deferred_data(
rv = nghttp2_stream_resume_deferred_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, session);
if (nghttp2_is_fatal(rv)) {
@ -6038,11 +6038,11 @@ int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) {
int rv;
nghttp2_stream *stream;
stream = nghttp2_session_get_stream(session, stream_id);
if (stream == NULL || !nghttp2_stream_check_deferred_data(stream)) {
if (stream == NULL || !nghttp2_stream_check_deferred_item(stream)) {
return NGHTTP2_ERR_INVALID_ARGUMENT;
}
rv = nghttp2_stream_resume_deferred_data(
rv = nghttp2_stream_resume_deferred_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_USER, session);
if (nghttp2_is_fatal(rv)) {

View File

@ -42,7 +42,7 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
stream->state = initial_state;
stream->shut_flags = NGHTTP2_SHUT_NONE;
stream->stream_user_data = stream_user_data;
stream->data_item = NULL;
stream->item = NULL;
stream->remote_window_size = remote_initial_window_size;
stream->local_window_size = local_initial_window_size;
stream->recv_window_size = 0;
@ -57,7 +57,7 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
stream->closed_prev = NULL;
stream->closed_next = NULL;
stream->dpri = NGHTTP2_STREAM_DPRI_NO_DATA;
stream->dpri = NGHTTP2_STREAM_DPRI_NO_ITEM;
stream->num_substreams = 1;
stream->weight = weight;
stream->effective_weight = stream->weight;
@ -71,7 +71,7 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
}
void nghttp2_stream_free(nghttp2_stream *stream _U_) {
/* We don't free stream->data_item. If it is assigned to aob, then
/* We don't free stream->item. If it is assigned to aob, then
active_outbound_item_reset() will delete it. If it is queued,
then it is deleted when pq is deleted in nghttp2_session_del().
Otherwise, nghttp2_session_del() will delete it. */
@ -81,14 +81,14 @@ void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag) {
stream->shut_flags |= flag;
}
static int stream_push_data(nghttp2_stream *stream, nghttp2_session *session) {
static int stream_push_item(nghttp2_stream *stream, nghttp2_session *session) {
int rv;
nghttp2_outbound_item *item;
assert(stream->data_item);
assert(stream->data_item->queued == 0);
assert(stream->item);
assert(stream->item->queued == 0);
item = stream->data_item;
item = stream->item;
/* If item is now sent, don't push it to the queue. Otherwise, we
may push same item twice. */
@ -200,7 +200,7 @@ static void stream_update_dep_effective_weight(nghttp2_stream *stream) {
/* stream->sum_norest_weight == 0 means there is no
NGHTTP2_STREAM_DPRI_TOP under stream */
if (stream->dpri != NGHTTP2_STREAM_DPRI_NO_DATA ||
if (stream->dpri != NGHTTP2_STREAM_DPRI_NO_ITEM ||
stream->sum_norest_weight == 0) {
return;
}
@ -235,8 +235,8 @@ static void stream_update_dep_effective_weight(nghttp2_stream *stream) {
continue;
}
if (si->dpri == NGHTTP2_STREAM_DPRI_NO_DATA) {
DEBUGF(fprintf(stderr, "stream: stream=%d no_data, ignored\n",
if (si->dpri == NGHTTP2_STREAM_DPRI_NO_ITEM) {
DEBUGF(fprintf(stderr, "stream: stream=%d no_item, ignored\n",
si->stream_id));
/* Since we marked NGHTTP2_STREAM_DPRI_TOP under si, we make
@ -285,7 +285,7 @@ static void stream_update_dep_set_top(nghttp2_stream *stream) {
if (stream->dpri == NGHTTP2_STREAM_DPRI_REST) {
DEBUGF(
fprintf(stderr, "stream: stream=%d data is top\n", stream->stream_id));
fprintf(stderr, "stream: stream=%d item is top\n", stream->stream_id));
stream->dpri = NGHTTP2_STREAM_DPRI_TOP;
@ -317,9 +317,9 @@ static int stream_update_dep_queue_top(nghttp2_stream *stream,
}
if (stream->dpri == NGHTTP2_STREAM_DPRI_TOP) {
if (!stream->data_item->queued) {
if (!stream->item->queued) {
DEBUGF(fprintf(stderr, "stream: stream=%d enqueue\n", stream->stream_id));
rv = stream_push_data(stream, session);
rv = stream_push_item(stream, session);
if (rv != 0) {
return rv;
@ -343,7 +343,7 @@ static int stream_update_dep_queue_top(nghttp2_stream *stream,
/*
* Updates stream->sum_norest_weight and stream->sum_top_weight
* recursively. We have to gather effective sum of weight of
* descendants. If stream->dpri == NGHTTP2_STREAM_DPRI_NO_DATA, we
* descendants. If stream->dpri == NGHTTP2_STREAM_DPRI_NO_ITEM, we
* have to go deeper and check that any of its descendants has dpri
* value of NGHTTP2_STREAM_DPRI_TOP. If so, we have to add weight of
* its direct descendants to stream->sum_norest_weight. To make this
@ -386,7 +386,7 @@ static int stream_update_dep_sum_norest_weight(nghttp2_stream *stream) {
return rv;
}
static int stream_update_dep_on_attach_data(nghttp2_stream *stream,
static int stream_update_dep_on_attach_item(nghttp2_stream *stream,
nghttp2_session *session) {
nghttp2_stream *root_stream;
@ -406,11 +406,11 @@ static int stream_update_dep_on_attach_data(nghttp2_stream *stream,
return stream_update_dep_queue_top(root_stream, session);
}
static int stream_update_dep_on_detach_data(nghttp2_stream *stream,
static int stream_update_dep_on_detach_item(nghttp2_stream *stream,
nghttp2_session *session) {
nghttp2_stream *root_stream;
stream->dpri = NGHTTP2_STREAM_DPRI_NO_DATA;
stream->dpri = NGHTTP2_STREAM_DPRI_NO_ITEM;
root_stream = nghttp2_stream_get_dep_root(stream);
@ -422,49 +422,49 @@ static int stream_update_dep_on_detach_data(nghttp2_stream *stream,
return stream_update_dep_queue_top(root_stream, session);
}
int nghttp2_stream_attach_data(nghttp2_stream *stream,
nghttp2_outbound_item *data_item,
int nghttp2_stream_attach_item(nghttp2_stream *stream,
nghttp2_outbound_item *item,
nghttp2_session *session) {
assert((stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL) == 0);
assert(stream->data_item == NULL);
assert(stream->item == NULL);
DEBUGF(fprintf(stderr, "stream: stream=%d attach data=%p\n",
stream->stream_id, data_item));
DEBUGF(fprintf(stderr, "stream: stream=%d attach item=%p\n",
stream->stream_id, item));
stream->data_item = data_item;
stream->item = item;
return stream_update_dep_on_attach_data(stream, session);
return stream_update_dep_on_attach_item(stream, session);
}
int nghttp2_stream_detach_data(nghttp2_stream *stream,
int nghttp2_stream_detach_item(nghttp2_stream *stream,
nghttp2_session *session) {
DEBUGF(fprintf(stderr, "stream: stream=%d detach data=%p\n",
stream->stream_id, stream->data_item));
DEBUGF(fprintf(stderr, "stream: stream=%d detach item=%p\n",
stream->stream_id, stream->item));
stream->data_item = NULL;
stream->item = NULL;
stream->flags &= ~NGHTTP2_STREAM_FLAG_DEFERRED_ALL;
return stream_update_dep_on_detach_data(stream, session);
return stream_update_dep_on_detach_item(stream, session);
}
int nghttp2_stream_defer_data(nghttp2_stream *stream, uint8_t flags,
int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags,
nghttp2_session *session) {
assert(stream->data_item);
assert(stream->item);
DEBUGF(fprintf(stderr, "stream: stream=%d defer data=%p cause=%02x\n",
stream->stream_id, stream->data_item, flags));
DEBUGF(fprintf(stderr, "stream: stream=%d defer item=%p cause=%02x\n",
stream->stream_id, stream->item, flags));
stream->flags |= flags;
return stream_update_dep_on_detach_data(stream, session);
return stream_update_dep_on_detach_item(stream, session);
}
int nghttp2_stream_resume_deferred_data(nghttp2_stream *stream, uint8_t flags,
int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags,
nghttp2_session *session) {
assert(stream->data_item);
assert(stream->item);
DEBUGF(fprintf(stderr, "stream: stream=%d resume data=%p flags=%02x\n",
stream->stream_id, stream->data_item, flags));
DEBUGF(fprintf(stderr, "stream: stream=%d resume item=%p flags=%02x\n",
stream->stream_id, stream->item, flags));
stream->flags &= ~flags;
@ -472,16 +472,15 @@ int nghttp2_stream_resume_deferred_data(nghttp2_stream *stream, uint8_t flags,
return 0;
}
return stream_update_dep_on_attach_data(stream, session);
return stream_update_dep_on_attach_item(stream, session);
}
int nghttp2_stream_check_deferred_data(nghttp2_stream *stream) {
return stream->data_item &&
(stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL);
int nghttp2_stream_check_deferred_item(nghttp2_stream *stream) {
return stream->item && (stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_ALL);
}
int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream) {
return stream->data_item &&
return stream->item &&
(stream->flags & NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL);
}
@ -560,7 +559,7 @@ void nghttp2_stream_dep_insert(nghttp2_stream *dep_stream,
nghttp2_stream *si;
nghttp2_stream *root_stream;
assert(stream->data_item == NULL);
assert(stream->item == NULL);
DEBUGF(fprintf(stderr,
"stream: dep_insert dep_stream(%p)=%d, stream(%p)=%d\n",
@ -690,7 +689,7 @@ void nghttp2_stream_dep_add(nghttp2_stream *dep_stream,
nghttp2_stream *stream) {
nghttp2_stream *root_stream;
assert(stream->data_item == NULL);
assert(stream->item == NULL);
DEBUGF(fprintf(stderr, "stream: dep_add dep_stream(%p)=%d, stream(%p)=%d\n",
dep_stream, dep_stream->stream_id, stream, stream->stream_id));

View File

@ -100,7 +100,7 @@ typedef enum {
typedef enum {
NGHTTP2_STREAM_DPRI_NONE = 0,
NGHTTP2_STREAM_DPRI_NO_DATA = 0x01,
NGHTTP2_STREAM_DPRI_NO_ITEM = 0x01,
NGHTTP2_STREAM_DPRI_TOP = 0x02,
NGHTTP2_STREAM_DPRI_REST = 0x04
} nghttp2_stream_dpri;
@ -139,7 +139,7 @@ struct nghttp2_stream {
/* The arbitrary data provided by user for this stream. */
void *stream_user_data;
/* Item to send */
nghttp2_outbound_item *data_item;
nghttp2_outbound_item *item;
/* stream ID */
int32_t stream_id;
/* categorized priority of this stream. Only stream bearing
@ -201,9 +201,9 @@ void nghttp2_stream_free(nghttp2_stream *stream);
void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag);
/*
* Defer |stream->data_item|. We won't call this function in the
* situation where |stream->data_item| == NULL. If |flags| is bitwise
* OR of zero or more of NGHTTP2_STREAM_FLAG_DEFERRED_USER and
* Defer |stream->item|. We won't call this function in the situation
* where |stream->item| == NULL. The |flags| is bitwise OR of zero or
* more of NGHTTP2_STREAM_FLAG_DEFERRED_USER and
* NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL. The |flags| indicates
* the reason of this action.
*
@ -213,7 +213,7 @@ void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag);
* NGHTTP2_ERR_NOMEM
* Out of memory
*/
int nghttp2_stream_defer_data(nghttp2_stream *stream, uint8_t flags,
int nghttp2_stream_defer_item(nghttp2_stream *stream, uint8_t flags,
nghttp2_session *session);
/*
@ -224,16 +224,16 @@ int nghttp2_stream_defer_data(nghttp2_stream *stream, uint8_t flags,
* cleared if they are set. So even if this function is called, if
* one of flag is still set, data does not become active.
*/
int nghttp2_stream_resume_deferred_data(nghttp2_stream *stream, uint8_t flags,
int nghttp2_stream_resume_deferred_item(nghttp2_stream *stream, uint8_t flags,
nghttp2_session *session);
/*
* Returns nonzero if data item is deferred by whatever reason.
* Returns nonzero if item is deferred by whatever reason.
*/
int nghttp2_stream_check_deferred_data(nghttp2_stream *stream);
int nghttp2_stream_check_deferred_item(nghttp2_stream *stream);
/*
* Returns nonzero if data item is deferred by flow control.
* Returns nonzero if item is deferred by flow control.
*/
int nghttp2_stream_check_deferred_by_flow_control(nghttp2_stream *stream);
@ -322,7 +322,7 @@ void nghttp2_stream_dep_add(nghttp2_stream *dep_stream, nghttp2_stream *stream);
void nghttp2_stream_dep_remove(nghttp2_stream *stream);
/*
* Attaches |data_item| to |stream|. Updates dpri members in this
* Attaches |item| to |stream|. Updates dpri members in this
* dependency tree.
*
* This function returns 0 if it succeeds, or one of the following
@ -331,14 +331,14 @@ void nghttp2_stream_dep_remove(nghttp2_stream *stream);
* NGHTTP2_ERR_NOMEM
* Out of memory
*/
int nghttp2_stream_attach_data(nghttp2_stream *stream,
nghttp2_outbound_item *data_item,
int nghttp2_stream_attach_item(nghttp2_stream *stream,
nghttp2_outbound_item *item,
nghttp2_session *session);
/*
* Detaches |stream->data_item|. Updates dpri members in this
* dependency tree. This function does not free |stream->data_item|.
* The caller must free it.
* Detaches |stream->item|. Updates dpri members in this dependency
* tree. This function does not free |stream->item|. The caller must
* free it.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
@ -346,7 +346,7 @@ int nghttp2_stream_attach_data(nghttp2_stream *stream,
* NGHTTP2_ERR_NOMEM
* Out of memory
*/
int nghttp2_stream_detach_data(nghttp2_stream *stream,
int nghttp2_stream_detach_item(nghttp2_stream *stream,
nghttp2_session *session);
/*

View File

@ -231,10 +231,10 @@ int main(int argc _U_, char *argv[] _U_) {
!CU_add_test(
pSuite, "session_stream_dep_all_your_stream_are_belong_to_us",
test_nghttp2_session_stream_dep_all_your_stream_are_belong_to_us) ||
!CU_add_test(pSuite, "session_stream_attach_data",
test_nghttp2_session_stream_attach_data) ||
!CU_add_test(pSuite, "session_stream_attach_data_subtree",
test_nghttp2_session_stream_attach_data_subtree) ||
!CU_add_test(pSuite, "session_stream_attach_item",
test_nghttp2_session_stream_attach_item) ||
!CU_add_test(pSuite, "session_stream_attach_item_subtree",
test_nghttp2_session_stream_attach_item_subtree) ||
!CU_add_test(pSuite, "session_stream_keep_closed_stream",
test_nghttp2_session_keep_closed_stream) ||
!CU_add_test(pSuite, "session_stream_keep_idle_stream",

View File

@ -2495,7 +2495,7 @@ void test_nghttp2_session_on_window_update_received(void) {
data_item = create_data_ob_item();
CU_ASSERT(0 == nghttp2_stream_attach_data(stream, data_item, session));
CU_ASSERT(0 == nghttp2_stream_attach_item(stream, data_item, session));
nghttp2_frame_window_update_init(&frame.window_update, NGHTTP2_FLAG_NONE, 1,
16 * 1024);
@ -2506,7 +2506,7 @@ void test_nghttp2_session_on_window_update_received(void) {
stream->remote_window_size);
CU_ASSERT(0 ==
nghttp2_stream_defer_data(
nghttp2_stream_defer_item(
stream, NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL, session));
CU_ASSERT(0 == nghttp2_session_on_window_update_received(session, &frame));
@ -4255,7 +4255,7 @@ void test_nghttp2_session_pop_next_ob_item(void) {
stream = nghttp2_session_get_stream(session, 1);
nghttp2_stream_detach_data(stream, session);
nghttp2_stream_detach_item(stream, session);
nghttp2_outbound_item_free(item, mem);
free(item);
@ -4736,9 +4736,9 @@ void test_nghttp2_session_data_read_temporal_failure(void) {
stream = nghttp2_session_get_stream(session, 1);
CU_ASSERT(nghttp2_stream_check_deferred_by_flow_control(stream));
CU_ASSERT(NGHTTP2_DATA == stream->data_item->frame.hd.type);
CU_ASSERT(NGHTTP2_DATA == stream->item->frame.hd.type);
stream->data_item->aux_data.data.data_prd.read_callback =
stream->item->aux_data.data.data_prd.read_callback =
temporal_failure_data_source_read_callback;
/* Back NGHTTP2_INITIAL_WINDOW_SIZE to both connection-level and
@ -5813,7 +5813,7 @@ void test_nghttp2_session_stream_dep_all_your_stream_are_belong_to_us(void) {
nghttp2_session_del(session);
}
void test_nghttp2_session_stream_attach_data(void) {
void test_nghttp2_session_stream_attach_item(void) {
nghttp2_session *session;
nghttp2_session_callbacks callbacks;
nghttp2_stream *a, *b, *c, *d;
@ -5837,12 +5837,12 @@ void test_nghttp2_session_stream_attach_data(void) {
db = create_data_ob_item();
nghttp2_stream_attach_data(b, db, session);
nghttp2_stream_attach_item(b, db, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(16 == b->effective_weight);
@ -5852,12 +5852,12 @@ void test_nghttp2_session_stream_attach_data(void) {
dc = create_data_ob_item();
nghttp2_stream_attach_data(c, dc, session);
nghttp2_stream_attach_item(c, dc, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(16 * 16 / 32 == b->effective_weight);
CU_ASSERT(16 * 16 / 32 == c->effective_weight);
@ -5868,32 +5868,32 @@ void test_nghttp2_session_stream_attach_data(void) {
da = create_data_ob_item();
nghttp2_stream_attach_data(a, da, session);
nghttp2_stream_attach_item(a, da, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(16 == a->effective_weight);
CU_ASSERT(1 == da->queued);
nghttp2_stream_detach_data(a, session);
nghttp2_stream_detach_item(a, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(16 * 16 / 32 == b->effective_weight);
CU_ASSERT(16 * 16 / 32 == c->effective_weight);
dd = create_data_ob_item();
nghttp2_stream_attach_data(d, dd, session);
nghttp2_stream_attach_item(d, dd, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == d->dpri);
@ -5903,22 +5903,22 @@ void test_nghttp2_session_stream_attach_data(void) {
CU_ASSERT(0 == dd->queued);
nghttp2_stream_detach_data(c, session);
nghttp2_stream_detach_item(c, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == d->dpri);
CU_ASSERT(16 * 16 / 16 == b->effective_weight);
CU_ASSERT(0 == dd->queued);
nghttp2_stream_detach_data(b, session);
nghttp2_stream_detach_item(b, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == d->dpri);
CU_ASSERT(16 * 16 / 16 == d->effective_weight);
@ -5928,7 +5928,7 @@ void test_nghttp2_session_stream_attach_data(void) {
nghttp2_session_del(session);
}
void test_nghttp2_session_stream_attach_data_subtree(void) {
void test_nghttp2_session_stream_attach_item_subtree(void) {
nghttp2_session *session;
nghttp2_session_callbacks callbacks;
nghttp2_stream *a, *b, *c, *d, *e, *f;
@ -5955,18 +5955,18 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
de = create_data_ob_item();
nghttp2_stream_attach_data(e, de, session);
nghttp2_stream_attach_item(e, de, session);
db = create_data_ob_item();
nghttp2_stream_attach_data(b, db, session);
nghttp2_stream_attach_item(b, db, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(16 == b->effective_weight);
CU_ASSERT(16 == e->effective_weight);
@ -5986,12 +5986,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* d
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(16 == e->effective_weight);
@ -6011,12 +6011,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* d
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(16 == b->effective_weight);
CU_ASSERT(16 == e->effective_weight);
@ -6027,12 +6027,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
nghttp2_stream_dep_make_root(a, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
/* Remove subtree c */
@ -6048,16 +6048,16 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* f
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
dd = create_data_ob_item();
nghttp2_stream_attach_data(d, dd, session);
nghttp2_stream_attach_item(d, dd, session);
/* Add subtree c to a */
@ -6072,12 +6072,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* d f
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(16 == b->effective_weight);
CU_ASSERT(16 * 16 / 16 == e->effective_weight);
@ -6100,12 +6100,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* f d
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(16 == b->effective_weight);
@ -6125,12 +6125,12 @@ void test_nghttp2_session_stream_attach_data_subtree(void) {
* f d
*/
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == d->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == e->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_DATA == f->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == f->dpri);
CU_ASSERT(0 == a->sum_norest_weight);
CU_ASSERT(0 == b->sum_norest_weight);

View File

@ -108,8 +108,8 @@ void test_nghttp2_session_stream_dep_remove(void);
void test_nghttp2_session_stream_dep_add_subtree(void);
void test_nghttp2_session_stream_dep_remove_subtree(void);
void test_nghttp2_session_stream_dep_all_your_stream_are_belong_to_us(void);
void test_nghttp2_session_stream_attach_data(void);
void test_nghttp2_session_stream_attach_data_subtree(void);
void test_nghttp2_session_stream_attach_item(void);
void test_nghttp2_session_stream_attach_item_subtree(void);
void test_nghttp2_session_keep_closed_stream(void);
void test_nghttp2_session_keep_idle_stream(void);
void test_nghttp2_session_detach_idle_stream(void);