Remove push related members from nghttp2_stream

This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-23 00:46:55 +09:00
parent 4b6885ce9f
commit ef3caffe8b
5 changed files with 0 additions and 66 deletions

View File

@ -40,9 +40,6 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
stream->pri = pri;
stream->state = initial_state;
stream->shut_flags = NGHTTP2_SHUT_NONE;
stream->pushed_streams = NULL;
stream->pushed_streams_length = 0;
stream->pushed_streams_capacity = 0;
stream->stream_user_data = stream_user_data;
stream->deferred_data = NULL;
stream->deferred_flags = NGHTTP2_DEFERRED_NONE;
@ -54,7 +51,6 @@ void nghttp2_stream_init(nghttp2_stream *stream, int32_t stream_id,
void nghttp2_stream_free(nghttp2_stream *stream)
{
free(stream->pushed_streams);
nghttp2_outbound_item_free(stream->deferred_data);
free(stream->deferred_data);
}
@ -64,23 +60,6 @@ void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag)
stream->shut_flags |= flag;
}
int nghttp2_stream_add_pushed_stream(nghttp2_stream *stream, int32_t stream_id)
{
if(stream->pushed_streams_capacity == stream->pushed_streams_length) {
int32_t *streams;
size_t capacity = stream->pushed_streams_capacity == 0 ?
5 : stream->pushed_streams_capacity*2;
streams = realloc(stream->pushed_streams, capacity*sizeof(uint32_t));
if(streams == NULL) {
return NGHTTP2_ERR_NOMEM;
}
stream->pushed_streams = streams;
stream->pushed_streams_capacity = capacity;
}
stream->pushed_streams[stream->pushed_streams_length++] = stream_id;
return 0;
}
void nghttp2_stream_defer_data(nghttp2_stream *stream,
nghttp2_outbound_item *data,
uint8_t flags)

View File

@ -88,14 +88,6 @@ typedef struct {
int32_t pri;
/* Bitwise OR of zero or more nghttp2_shut_flag values */
uint8_t shut_flags;
/* The array of server-pushed stream IDs which associate them to
this stream. */
int32_t *pushed_streams;
/* The number of stored pushed stream ID in |pushed_streams| */
size_t pushed_streams_length;
/* The maximum number of stream ID the |pushed_streams| can
store. */
size_t pushed_streams_capacity;
/* The arbitrary data provided by user for this stream. */
void *stream_user_data;
/* Deferred DATA frame */
@ -139,19 +131,6 @@ void nghttp2_stream_free(nghttp2_stream *stream);
*/
void nghttp2_stream_shutdown(nghttp2_stream *stream, nghttp2_shut_flag flag);
/*
* Add server-pushed |stream_id| to this stream. This happens when
* server-pushed stream is associated to this stream. This function
* returns 0 if it succeeds, or negative error code.
*
* RETURN VALUE
* ------------
*
* NGHTTP2_ERR_NOMEM
* Out of memory.
*/
int nghttp2_stream_add_pushed_stream(nghttp2_stream *stream, int32_t stream_id);
/*
* Defer DATA frame |data|. We won't call this function in the
* situation where stream->deferred_data != NULL. If |flags| is

View File

@ -185,10 +185,6 @@ int main(int argc, char* argv[])
test_nghttp2_frame_pack_goaway) ||
!CU_add_test(pSuite, "frame_pack_window_update",
test_nghttp2_frame_pack_window_update) ||
/* !CU_add_test(pSuite, "stream_add_pushed_stream", */
/* test_nghttp2_stream_add_pushed_stream) || */
!CU_add_test(pSuite, "hd_deflate", test_nghttp2_hd_deflate) ||
!CU_add_test(pSuite, "hd_inflate_indname_inc",
test_nghttp2_hd_inflate_indname_inc) ||

View File

@ -27,21 +27,3 @@
#include <CUnit/CUnit.h>
#include "nghttp2_stream.h"
void test_nghttp2_stream_add_pushed_stream(void)
{
nghttp2_stream stream;
int i, n;
nghttp2_stream_init(&stream, 1, NGHTTP2_FLAG_NONE, 1 << 30,
NGHTTP2_STREAM_OPENING, 1, 1, 65536, NULL);
n = 26;
for(i = 2; i < n; i += 2) {
CU_ASSERT(0 == nghttp2_stream_add_pushed_stream(&stream, i));
CU_ASSERT((size_t)i/2 == stream.pushed_streams_length);
}
for(i = 2; i < n; i += 2) {
CU_ASSERT(i == stream.pushed_streams[i/2-1]);
}
CU_ASSERT(1 << 30 == stream.pri);
nghttp2_stream_free(&stream);
}

View File

@ -25,6 +25,4 @@
#ifndef NGHTTP2_STREAM_TEST_H
#define NGHTTP2_STREAM_TEST_H
void test_nghttp2_stream_add_pushed_stream(void);
#endif /* NGHTTP2_STREAM_TEST_H */