From 575b4200a72dfdb081fb8c9063cad8d94841dd16 Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Tue, 10 Nov 2015 20:56:15 +0000
Subject: [PATCH] Small fixes

---
 src/core/transport/chttp2/hpack_table.c        | 3 +--
 src/core/transport/chttp2/hpack_table.h        | 2 --
 test/core/end2end/fixtures/proxy.c             | 2 --
 test/core/transport/chttp2/hpack_parser_test.c | 3 ++-
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c
index fabc950872..0b034b72a4 100644
--- a/src/core/transport/chttp2/hpack_table.c
+++ b/src/core/transport/chttp2/hpack_table.c
@@ -324,10 +324,9 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
   }
 
   /* copy the finalized entry in */
-  tbl->ents[tbl->last_ent] = GRPC_MDELEM_REF(md);
+  tbl->ents[(tbl->first_ent + tbl->num_ents) % tbl->cap_entries] = GRPC_MDELEM_REF(md);
 
   /* update accounting values */
-  tbl->last_ent = ((tbl->last_ent + 1) % tbl->cap_entries);
   tbl->num_ents++;
   tbl->mem_used += (gpr_uint32)elem_bytes;
   return 1;
diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/transport/chttp2/hpack_table.h
index 6d506de8a5..e03b8c19b3 100644
--- a/src/core/transport/chttp2/hpack_table.h
+++ b/src/core/transport/chttp2/hpack_table.h
@@ -62,8 +62,6 @@ typedef struct {
   grpc_mdctx *mdctx;
   /* the first used entry in ents */
   gpr_uint32 first_ent;
-  /* the last used entry in ents */
-  gpr_uint32 last_ent;
   /* how many entries are in the table */
   gpr_uint32 num_ents;
   /* the amount of memory used by the table, according to the hpack algorithm */
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index 1090ad667d..b793358653 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -146,7 +146,6 @@ void grpc_end2end_proxy_destroy(grpc_end2end_proxy *proxy) {
 }
 
 static void unrefpc(proxy_call *pc, const char *reason) {
-  gpr_log(GPR_DEBUG, "PROXY UNREF %s", reason);
   if (gpr_unref(&pc->refs)) {
     grpc_call_destroy(pc->c2p);
     grpc_call_destroy(pc->p2s);
@@ -159,7 +158,6 @@ static void unrefpc(proxy_call *pc, const char *reason) {
 }
 
 static void refpc(proxy_call *pc, const char *reason) {
-  gpr_log(GPR_DEBUG, "PROXY   REF %s", reason);
   gpr_ref(&pc->refs);
 }
 
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c
index 3a313375a4..e4cabeae3b 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -151,7 +151,8 @@ static void test_vectors(grpc_slice_split_mode mode) {
   grpc_chttp2_hpack_parser_destroy(&parser);
 
   grpc_chttp2_hpack_parser_init(&parser, mdctx);
-  parser.table.max_bytes = 256;
+grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
+grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
   /* D.5.1 */
   test_vector(&parser, mode,
               "4803 3330 3258 0770 7269 7661 7465 611d"
-- 
GitLab