From ef3caffe8bf411d62d262ed5c4f842678020ed03 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 23 Jul 2013 00:46:55 +0900 Subject: [PATCH] Remove push related members from nghttp2_stream --- lib/nghttp2_stream.c | 21 --------------------- lib/nghttp2_stream.h | 21 --------------------- tests/main.c | 4 ---- tests/nghttp2_stream_test.c | 18 ------------------ tests/nghttp2_stream_test.h | 2 -- 5 files changed, 66 deletions(-) diff --git a/lib/nghttp2_stream.c b/lib/nghttp2_stream.c index 6a0af20d..354c3b5a 100644 --- a/lib/nghttp2_stream.c +++ b/lib/nghttp2_stream.c @@ -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) diff --git a/lib/nghttp2_stream.h b/lib/nghttp2_stream.h index dd5d34ce..a98c4a8d 100644 --- a/lib/nghttp2_stream.h +++ b/lib/nghttp2_stream.h @@ -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 diff --git a/tests/main.c b/tests/main.c index 62da0b2d..73497cea 100644 --- a/tests/main.c +++ b/tests/main.c @@ -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) || diff --git a/tests/nghttp2_stream_test.c b/tests/nghttp2_stream_test.c index a8eb15d2..0b3f6dd4 100644 --- a/tests/nghttp2_stream_test.c +++ b/tests/nghttp2_stream_test.c @@ -27,21 +27,3 @@ #include #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); -} diff --git a/tests/nghttp2_stream_test.h b/tests/nghttp2_stream_test.h index 721f6d12..36f6973c 100644 --- a/tests/nghttp2_stream_test.h +++ b/tests/nghttp2_stream_test.h @@ -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 */