diff options
author | Sree Kuchibhotla <sreecha@users.noreply.github.com> | 2015-12-03 11:05:06 -0800 |
---|---|---|
committer | Sree Kuchibhotla <sreecha@users.noreply.github.com> | 2015-12-03 11:05:06 -0800 |
commit | adb2e9f47192a47ed0755c01704633e07112ff26 (patch) | |
tree | 2bd2d8f934dd75b94921cbf282056dd884585eb3 /src/core/transport | |
parent | 8b5122e7794abff85e7cfdf3c7b0e0581fbac0ab (diff) | |
parent | e62bf9844ce63b3075641e6a08f06dcaa627f8ed (diff) |
Merge pull request #4270 from ctiller/consistent-encoding-test
Fix HPACK encoder test
Diffstat (limited to 'src/core/transport')
-rw-r--r-- | src/core/transport/metadata.c | 10 | ||||
-rw-r--r-- | src/core/transport/metadata.h | 6 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index a76d1ad3a5..d6fb255eb6 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -132,6 +132,7 @@ typedef struct mdtab_shard { /* hash seed: decided at initialization time */ static gpr_uint32 g_hash_seed; +static int g_forced_hash_seed = 0; /* linearly probed hash tables for static element lookup */ static grpc_mdstr *g_static_strtab[GRPC_STATIC_MDSTR_COUNT * 2]; @@ -144,9 +145,16 @@ static mdtab_shard g_mdtab_shard[MDTAB_SHARD_COUNT]; static void gc_mdtab(mdtab_shard *shard); +void grpc_test_only_set_metadata_hash_seed(gpr_uint32 seed) { + g_hash_seed = seed; + g_forced_hash_seed = 1; +} + void grpc_mdctx_global_init(void) { size_t i, j; - g_hash_seed = (gpr_uint32)gpr_now(GPR_CLOCK_REALTIME).tv_nsec; + if (!g_forced_hash_seed) { + g_hash_seed = (gpr_uint32)gpr_now(GPR_CLOCK_REALTIME).tv_nsec; + } g_static_strtab_maxprobe = 0; g_static_mdtab_maxprobe = 0; /* build static tables */ diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index c1071e4e16..3d3efc682d 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -86,11 +86,7 @@ struct grpc_mdelem { /* there is a private part to this in metadata.c */ }; -/* Test only accessors to internal state - only for testing this code - do not - rely on it outside of metadata_test.c */ -size_t grpc_mdctx_get_mdtab_capacity_test_only(void); -size_t grpc_mdctx_get_mdtab_count_test_only(void); -size_t grpc_mdctx_get_mdtab_free_test_only(void); +void grpc_test_only_set_metadata_hash_seed(gpr_uint32 seed); /* Constructors for grpc_mdstr instances; take a variety of data types that clients may have handy */ |