diff options
author | Craig Tiller <ctiller@google.com> | 2015-11-10 14:24:36 +0000 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2015-11-10 14:24:36 +0000 |
commit | 3c53bb2f4680254a5e50228184ab8c2abae453f0 (patch) | |
tree | 9181880bfd3e0e3312a24a5351a4c560ae0e7b42 | |
parent | 856d0948daf8aee6f85b1e4864909f10f4b65ab2 (diff) |
clang-format
-rw-r--r-- | src/core/client_config/subchannel.h | 6 | ||||
-rw-r--r-- | src/core/iomgr/pollset_windows.c | 3 | ||||
-rw-r--r-- | src/core/surface/byte_buffer_reader.c | 1 | ||||
-rw-r--r-- | src/core/transport/chttp2/hpack_encoder.c | 34 | ||||
-rw-r--r-- | src/core/transport/chttp2/hpack_encoder.h | 8 | ||||
-rw-r--r-- | src/core/transport/chttp2/hpack_parser.c | 56 | ||||
-rw-r--r-- | src/core/transport/chttp2/hpack_table.c | 40 | ||||
-rw-r--r-- | src/core/transport/chttp2/hpack_table.h | 9 | ||||
-rw-r--r-- | src/core/transport/chttp2/parsing.c | 8 | ||||
-rw-r--r-- | src/core/transport/chttp2/writing.c | 11 | ||||
-rw-r--r-- | src/core/transport/chttp2_transport.c | 33 | ||||
-rw-r--r-- | test/core/client_config/lb_policies_test.c | 18 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_with_status.c | 3 | ||||
-rw-r--r-- | test/core/end2end/tests/hpack_size.c | 401 | ||||
-rw-r--r-- | test/core/end2end/tests/negative_deadline.c | 3 | ||||
-rw-r--r-- | test/core/network_benchmarks/low_level_ping_pong.c | 8 | ||||
-rw-r--r-- | test/core/surface/byte_buffer_reader_test.c | 4 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_table_test.c | 16 | ||||
-rw-r--r-- | test/cpp/qps/client.h | 46 |
19 files changed, 365 insertions, 343 deletions
diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h index 1fefa1888a..381b7689b8 100644 --- a/src/core/client_config/subchannel.h +++ b/src/core/client_config/subchannel.h @@ -77,10 +77,10 @@ void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx, /** construct a subchannel call (possibly asynchronously). * - * If the returned status is 1, the call will return immediately and \a target - * will point to a connected \a subchannel_call instance. Note that \a notify + * If the returned status is 1, the call will return immediately and \a target + * will point to a connected \a subchannel_call instance. Note that \a notify * will \em not be invoked in this case. - * Otherwise, if the returned status is 0, the subchannel call will be created + * Otherwise, if the returned status is 0, the subchannel call will be created * asynchronously, invoking the \a notify callback upon completion. */ int grpc_subchannel_create_call(grpc_exec_ctx *exec_ctx, grpc_subchannel *subchannel, diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index c3f310ee27..deb661548d 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -126,7 +126,8 @@ void grpc_pollset_destroy(grpc_pollset *pollset) {} void grpc_pollset_reset(grpc_pollset *pollset) { GPR_ASSERT(pollset->shutting_down); - GPR_ASSERT(!has_workers(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET)); + GPR_ASSERT( + !has_workers(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET)); pollset->shutting_down = 0; pollset->is_iocp_worker = 0; pollset->kicked_without_pollers = 0; diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 9f830df68c..57417f41b0 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -121,4 +121,3 @@ gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) { } return out_slice; } - diff --git a/src/core/transport/chttp2/hpack_encoder.c b/src/core/transport/chttp2/hpack_encoder.c index 7ec5a4fb2d..f89159bad1 100644 --- a/src/core/transport/chttp2/hpack_encoder.c +++ b/src/core/transport/chttp2/hpack_encoder.c @@ -160,13 +160,11 @@ static void evict_entry(grpc_chttp2_hpack_compressor *c) { c->tail_remote_index++; GPR_ASSERT(c->tail_remote_index > 0); GPR_ASSERT(c->table_size >= - c->table_elem_size[c->tail_remote_index % - c->cap_table_elems]); + c->table_elem_size[c->tail_remote_index % c->cap_table_elems]); GPR_ASSERT(c->table_elems > 0); - c->table_size = - (gpr_uint16)(c->table_size - - c->table_elem_size[c->tail_remote_index % - c->cap_table_elems]); + c->table_size = (gpr_uint16)( + c->table_size - + c->table_elem_size[c->tail_remote_index % c->cap_table_elems]); c->table_elems--; } @@ -194,8 +192,7 @@ static void add_elem(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem) { evict_entry(c); } GPR_ASSERT(c->table_elems < c->max_table_size); - c->table_elem_size[new_index % c->cap_table_elems] = - (gpr_uint16)elem_size; + c->table_elem_size[new_index % c->cap_table_elems] = (gpr_uint16)elem_size; c->table_size = (gpr_uint16)(c->table_size + elem_size); c->table_elems++; @@ -341,9 +338,11 @@ static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c, add_header_data(st, gpr_slice_ref(value_slice)); } -static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c, framer_state *st) { +static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c, + framer_state *st) { gpr_uint32 len = GRPC_CHTTP2_VARINT_LENGTH(c->max_table_size, 3); - GRPC_CHTTP2_WRITE_VARINT(c->max_table_size, 3, 0x20, add_tiny_header_data(st, len), len); + GRPC_CHTTP2_WRITE_VARINT(c->max_table_size, 3, 0x20, + add_tiny_header_data(st, len), len); c->advertise_table_size_change = 0; } @@ -477,8 +476,10 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c, c->max_table_size = GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE; c->cap_table_elems = c->max_table_elems = elems_for_bytes(c->max_table_size); c->max_usable_size = GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE; - c->table_elem_size = gpr_malloc(sizeof(*c->table_elem_size) * c->cap_table_elems); - memset(c->table_elem_size, 0, sizeof(*c->table_elem_size) * c->cap_table_elems); + c->table_elem_size = + gpr_malloc(sizeof(*c->table_elem_size) * c->cap_table_elems); + memset(c->table_elem_size, 0, + sizeof(*c->table_elem_size) * c->cap_table_elems); } void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor *c) { @@ -491,16 +492,19 @@ void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor *c) { gpr_free(c->table_elem_size); } -void grpc_chttp2_hpack_compressor_set_max_usable_size(grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size) { +void grpc_chttp2_hpack_compressor_set_max_usable_size( + grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size) { c->max_usable_size = max_table_size; - grpc_chttp2_hpack_compressor_set_max_table_size(c, GPR_MIN(c->max_table_size, max_table_size)); + grpc_chttp2_hpack_compressor_set_max_table_size( + c, GPR_MIN(c->max_table_size, max_table_size)); } static void rebuild_elems(grpc_chttp2_hpack_compressor *c, gpr_uint32 new_cap) { } -void grpc_chttp2_hpack_compressor_set_max_table_size(grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size) { +void grpc_chttp2_hpack_compressor_set_max_table_size( + grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size) { max_table_size = GPR_MIN(max_table_size, c->max_usable_size); if (max_table_size == c->max_table_size) { return; diff --git a/src/core/transport/chttp2/hpack_encoder.h b/src/core/transport/chttp2/hpack_encoder.h index ff32b08d60..ce83d101f2 100644 --- a/src/core/transport/chttp2/hpack_encoder.h +++ b/src/core/transport/chttp2/hpack_encoder.h @@ -46,7 +46,7 @@ /* initial table size, per spec */ #define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096 /* maximum table size we'll actually use */ -#define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024*1024) +#define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024) typedef struct { gpr_uint32 filter_elems_sum; @@ -89,8 +89,10 @@ typedef struct { void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c, grpc_mdctx *mdctx); void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor *c); -void grpc_chttp2_hpack_compressor_set_max_table_size(grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size); -void grpc_chttp2_hpack_compressor_set_max_usable_size(grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size); +void grpc_chttp2_hpack_compressor_set_max_table_size( + grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size); +void grpc_chttp2_hpack_compressor_set_max_usable_size( + grpc_chttp2_hpack_compressor *c, gpr_uint32 max_table_size); void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, gpr_uint32 id, grpc_metadata_batch *metadata, int is_eof, diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index 0f90f08b9c..57a3a20b1d 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -75,7 +75,7 @@ static int parse_begin(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, static int parse_error(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end); static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, - const gpr_uint8 *end); + const gpr_uint8 *end); static int parse_string_prefix(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end); @@ -625,7 +625,7 @@ static const gpr_uint8 inverse_base64[256] = { /* emission helpers */ static int on_hdr(grpc_chttp2_hpack_parser *p, grpc_mdelem *md, - int add_to_table) { + int add_to_table) { if (add_to_table) { if (!grpc_chttp2_hptbl_add(&p->table, md)) { return 0; @@ -750,19 +750,20 @@ static int finish_lithdr_incidx(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - GRPC_MDSTR_REF(md->key), - take_string(p, &p->value)), - 1) && parse_begin(p, cur, end); + GRPC_MDSTR_REF(md->key), + take_string(p, &p->value)), + 1) && + parse_begin(p, cur, end); } /* finish a literal header with incremental indexing with no index */ static int finish_lithdr_incidx_v(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - take_string(p, &p->key), - take_string(p, &p->value)), - 1) && - parse_begin(p, cur, end); + take_string(p, &p->key), + take_string(p, &p->value)), + 1) && + parse_begin(p, cur, end); } /* parse a literal header with incremental indexing; index < 63 */ @@ -802,19 +803,20 @@ static int finish_lithdr_notidx(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - GRPC_MDSTR_REF(md->key), - take_string(p, &p->value)), - 0) && - parse_begin(p, cur, end); + GRPC_MDSTR_REF(md->key), + take_string(p, &p->value)), + 0) && + parse_begin(p, cur, end); } /* finish a literal header without incremental indexing with index = 0 */ static int finish_lithdr_notidx_v(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - take_string(p, &p->key), - take_string(p, &p->value)), - 0) && parse_begin(p, cur, end); + take_string(p, &p->key), + take_string(p, &p->value)), + 0) && + parse_begin(p, cur, end); } /* parse a literal header without incremental indexing; index < 15 */ @@ -854,20 +856,20 @@ static int finish_lithdr_nvridx(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { grpc_mdelem *md = grpc_chttp2_hptbl_lookup(&p->table, p->index); return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - GRPC_MDSTR_REF(md->key), - take_string(p, &p->value)), - 0) && - parse_begin(p, cur, end); + GRPC_MDSTR_REF(md->key), + take_string(p, &p->value)), + 0) && + parse_begin(p, cur, end); } /* finish a literal header that is never indexed with an extra value */ static int finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { return on_hdr(p, grpc_mdelem_from_metadata_strings(p->table.mdctx, - take_string(p, &p->key), - take_string(p, &p->value)), - 0) && - parse_begin(p, cur, end); + take_string(p, &p->key), + take_string(p, &p->value)), + 0) && + parse_begin(p, cur, end); } /* parse a literal header that is never indexed; index < 15 */ @@ -906,7 +908,8 @@ static int parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser *p, static int finish_max_tbl_size(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index); - return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) && parse_begin(p, cur, end); + return grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index) && + parse_begin(p, cur, end); } /* parse a max table size change, max size < 15 */ @@ -934,7 +937,8 @@ static int parse_error(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, return 0; } -static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, const gpr_uint8 *end) { +static int parse_illegal_op(grpc_chttp2_hpack_parser *p, const gpr_uint8 *cur, + const gpr_uint8 *end) { GPR_ASSERT(cur != end); gpr_log(GPR_DEBUG, "Illegal hpack op code %d", *cur); return parse_error(p, cur, end); diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c index a94fdb994d..fabc950872 100644 --- a/src/core/transport/chttp2/hpack_table.c +++ b/src/core/transport/chttp2/hpack_table.c @@ -172,7 +172,8 @@ static struct { }; static gpr_uint32 entries_for_bytes(gpr_uint32 bytes) { - return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) / GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; + return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) / + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; } void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl, grpc_mdctx *mdctx) { @@ -180,8 +181,10 @@ void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl, grpc_mdctx *mdctx) { memset(tbl, 0, sizeof(*tbl)); tbl->mdctx = mdctx; - tbl->current_table_bytes = tbl->max_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE; - tbl->max_entries = tbl->cap_entries = entries_for_bytes(tbl->current_table_bytes); + tbl->current_table_bytes = tbl->max_bytes = + GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE; + tbl->max_entries = tbl->cap_entries = + entries_for_bytes(tbl->current_table_bytes); tbl->ents = gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries); memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries); for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) { @@ -196,8 +199,7 @@ void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl *tbl) { GRPC_MDELEM_UNREF(tbl->static_ents[i]); } for (i = 0; i < tbl->num_ents; i++) { - GRPC_MDELEM_UNREF( - tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]); + GRPC_MDELEM_UNREF(tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]); } gpr_free(tbl->ents); } @@ -211,8 +213,8 @@ grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl, /* Otherwise, find the value in the list of valid entries */ tbl_index -= (GRPC_CHTTP2_LAST_STATIC_ENTRY + 1); if (tbl_index < tbl->num_ents) { - gpr_uint32 offset = (tbl->num_ents - 1u - tbl_index + tbl->first_ent) % - tbl->cap_entries; + gpr_uint32 offset = + (tbl->num_ents - 1u - tbl_index + tbl->first_ent) % tbl->cap_entries; return tbl->ents[offset]; } /* Invalid entry: return error */ @@ -227,8 +229,7 @@ static void evict1(grpc_chttp2_hptbl *tbl) { GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; GPR_ASSERT(elem_bytes <= tbl->mem_used); tbl->mem_used -= (gpr_uint32)elem_bytes; - tbl->first_ent = - ((tbl->first_ent + 1) % tbl->cap_entries); + tbl->first_ent = ((tbl->first_ent + 1) % tbl->cap_entries); tbl->num_ents--; GRPC_MDELEM_UNREF(first_ent); } @@ -246,7 +247,8 @@ static void rebuild_ents(grpc_chttp2_hptbl *tbl, gpr_uint32 new_cap) { tbl->first_ent = 0; } -void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, gpr_uint32 max_bytes) { +void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, + gpr_uint32 max_bytes) { if (tbl->max_bytes == max_bytes) { return; } @@ -257,12 +259,15 @@ void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, gpr_uint32 max_byte tbl->max_bytes = max_bytes; } -int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, gpr_uint32 bytes) { +int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, + gpr_uint32 bytes) { if (tbl->current_table_bytes == bytes) { return 1; } if (bytes > tbl->max_bytes) { - gpr_log(GPR_ERROR, "Attempt to make hpack table %d bytes when max is %d bytes", bytes, tbl->max_bytes); + gpr_log(GPR_ERROR, + "Attempt to make hpack table %d bytes when max is %d bytes", bytes, + tbl->max_bytes); return 0; } gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes); @@ -289,7 +294,10 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) { GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD; if (tbl->current_table_bytes > tbl->max_bytes) { - gpr_log(GPR_ERROR, "HPACK max table size reduced to %d but not reflected by hpack stream", tbl->max_bytes); + gpr_log( + GPR_ERROR, + "HPACK max table size reduced to %d but not reflected by hpack stream", + tbl->max_bytes); return 0; } @@ -319,8 +327,7 @@ int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) { tbl->ents[tbl->last_ent] = GRPC_MDELEM_REF(md); /* update accounting values */ - tbl->last_ent = - ((tbl->last_ent + 1) % tbl->cap_entries); + tbl->last_ent = ((tbl->last_ent + 1) % tbl->cap_entries); tbl->num_ents++; tbl->mem_used += (gpr_uint32)elem_bytes; return 1; @@ -344,8 +351,7 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( for (i = 0; i < tbl->num_ents; i++) { gpr_uint32 idx = (gpr_uint32)(tbl->num_ents - i + GRPC_CHTTP2_LAST_STATIC_ENTRY); - grpc_mdelem *ent = - tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]; + grpc_mdelem *ent = tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]; if (md->key != ent->key) continue; r.index = idx; r.has_value = md->value == ent->value; diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/transport/chttp2/hpack_table.h index d3560d34e0..6d506de8a5 100644 --- a/src/core/transport/chttp2/hpack_table.h +++ b/src/core/transport/chttp2/hpack_table.h @@ -88,14 +88,17 @@ typedef struct { /* initialize a hpack table */ void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl *tbl, grpc_mdctx *mdctx); void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl *tbl); -void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, gpr_uint32 max_bytes); -int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, gpr_uint32 bytes); +void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl *tbl, + gpr_uint32 max_bytes); +int grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl, + gpr_uint32 bytes); /* lookup a table entry based on its hpack index */ grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl, gpr_uint32 index); /* add a table entry to the index */ -int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) GRPC_MUST_USE_RESULT; +int grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, + grpc_mdelem *md) GRPC_MUST_USE_RESULT; /* Find a key/value pair in the table... returns the index in the table of the most similar entry, or 0 if the value was not found */ typedef struct { diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c index 9a96a8ef4d..1e06532c03 100644 --- a/src/core/transport/chttp2/parsing.c +++ b/src/core/transport/chttp2/parsing.c @@ -78,7 +78,9 @@ void grpc_chttp2_prepare_to_read( GPR_TIMER_BEGIN("grpc_chttp2_prepare_to_read", 0); transport_parsing->next_stream_id = transport_global->next_stream_id; - transport_parsing->last_sent_max_table_size = transport_global->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]; + transport_parsing->last_sent_max_table_size = + transport_global->settings[GRPC_SENT_SETTINGS] + [GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]; /* update the parsing view of incoming window */ while (grpc_chttp2_list_pop_unannounced_incoming_window_available( @@ -821,7 +823,9 @@ static int init_settings_frame_parser( } if (transport_parsing->incoming_frame_flags & GRPC_CHTTP2_FLAG_ACK) { transport_parsing->settings_ack_received = 1; - grpc_chttp2_hptbl_set_max_bytes(&transport_parsing->hpack_parser.table, transport_parsing->last_sent_max_table_size); + grpc_chttp2_hptbl_set_max_bytes( + &transport_parsing->hpack_parser.table, + transport_parsing->last_sent_max_table_size); } transport_parsing->parser = grpc_chttp2_settings_parser_parse; transport_parsing->parser_data = &transport_parsing->simple.settings; diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index 7fe4d0b6bc..3cb28f8f0c 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -45,8 +45,7 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, int grpc_chttp2_unlocking_check_writes( grpc_chttp2_transport_global *transport_global, - grpc_chttp2_transport_writing *transport_writing, - int is_parsing) { + grpc_chttp2_transport_writing *transport_writing, int is_parsing) { grpc_chttp2_stream_global *stream_global; grpc_chttp2_stream_writing *stream_writing; @@ -56,11 +55,13 @@ int grpc_chttp2_unlocking_check_writes( gpr_slice_buffer_swap(&transport_global->qbuf, &transport_writing->outbuf); GPR_ASSERT(transport_global->qbuf.count == 0); - grpc_chttp2_hpack_compressor_set_max_table_size(&transport_writing->hpack_compressor, transport_global->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); + grpc_chttp2_hpack_compressor_set_max_table_size( + &transport_writing->hpack_compressor, + transport_global->settings[GRPC_PEER_SETTINGS] + [GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]); if (transport_global->dirtied_local_settings && - !transport_global->sent_local_settings && - !is_parsing) { + !transport_global->sent_local_settings && !is_parsing) { gpr_slice_buffer_add( &transport_writing->outbuf, grpc_chttp2_settings_create( diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 3aa2ef9892..fdd835def9 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -338,21 +338,30 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->global.next_stream_id = (gpr_uint32)channel_args->args[i].value.integer; } - } else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER)) { + } else if (0 == strcmp(channel_args->args[i].key, + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER)) { if (channel_args->args[i].type != GRPC_ARG_INTEGER) { - gpr_log(GPR_ERROR, "%s: must be an integer", GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER); + gpr_log(GPR_ERROR, "%s: must be an integer", + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER); } else if (channel_args->args[i].value.integer < 0) { - gpr_log(GPR_DEBUG, "%s: must be non-negative", GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER); + gpr_log(GPR_DEBUG, "%s: must be non-negative", + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER); } else { - push_setting(t, GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE, (gpr_uint32)channel_args->args[i].value.integer); + push_setting(t, GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE, + (gpr_uint32)channel_args->args[i].value.integer); } - } else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER)) { + } else if (0 == strcmp(channel_args->args[i].key, + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER)) { if (channel_args->args[i].type != GRPC_ARG_INTEGER) { - gpr_log(GPR_ERROR, "%s: must be an integer", GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER); + gpr_log(GPR_ERROR, "%s: must be an integer", + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER); } else if (channel_args->args[i].value.integer < 0) { - gpr_log(GPR_DEBUG, "%s: must be non-negative", GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER); + gpr_log(GPR_DEBUG, "%s: must be non-negative", + GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER); } else { - grpc_chttp2_hpack_compressor_set_max_usable_size(&t->writing.hpack_compressor, (gpr_uint32)channel_args->args[i].value.integer); + grpc_chttp2_hpack_compressor_set_max_usable_size( + &t->writing.hpack_compressor, + (gpr_uint32)channel_args->args[i].value.integer); } } } @@ -579,7 +588,8 @@ static void lock(grpc_chttp2_transport *t) { gpr_mu_lock(&t->mu); } static void unlock(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t) { GPR_TIMER_BEGIN("unlock", 0); if (!t->writing_active && !t->closed && - grpc_chttp2_unlocking_check_writes(&t->global, &t->writing, t->parsing_active)) { + grpc_chttp2_unlocking_check_writes(&t->global, &t->writing, + t->parsing_active)) { t->writing_active = 1; REF_TRANSPORT(t, "writing"); grpc_exec_ctx_enqueue(exec_ctx, &t->writing_action, 1); @@ -827,7 +837,7 @@ static void perform_stream_op_locked( } if (stream_global->write_closed) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_trailing_metadata_finished, + exec_ctx, &stream_global->send_trailing_metadata_finished, grpc_metadata_batch_is_empty(op->send_trailing_metadata)); } else if (stream_global->id != 0) { /* TODO(ctiller): check if there's flow control for any outstanding @@ -1054,7 +1064,8 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, to the upper layers - drop what we've got, and then publish what we want - which is safe because we haven't told anyone about the metadata yet */ - if (!stream_global->published_trailing_metadata || stream_global->recv_trailing_metadata_finished != NULL) { + if (!stream_global->published_trailing_metadata || + stream_global->recv_trailing_metadata_finished != NULL) { grpc_mdctx *mdctx = TRANSPORT_FROM_GLOBAL(transport_global)->metadata_context; char status_string[GPR_LTOA_MIN_BUFSIZE]; diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index e44930ed53..8498e1d827 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -135,9 +135,8 @@ static void kill_server(const servers_fixture *f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %d", i); GPR_ASSERT(f->servers[i] != NULL); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT( - grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); f->servers[i] = NULL; } @@ -203,8 +202,8 @@ static void teardown_servers(servers_fixture *f) { if (f->servers[i] == NULL) continue; grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), - n_millis_time(5000), NULL) - .type == GRPC_OP_COMPLETE); + n_millis_time(5000), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); } grpc_completion_queue_shutdown(f->cq); @@ -269,8 +268,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client, memset(s_valid, 0, f->num_servers * sizeof(int)); c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr", gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + "/foo", "foo.test.google.fr", + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); completed_client = 0; @@ -303,8 +302,9 @@ int *perform_request(servers_fixture *f, grpc_channel *client, grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL)); s_idx = -1; - while ((ev = grpc_completion_queue_next(f->cq, n_millis_time(s_idx == -1 ? 3000 : 200), NULL)) - .type != GRPC_QUEUE_TIMEOUT) { + while ((ev = grpc_completion_queue_next( + f->cq, n_millis_time(s_idx == -1 ? 3000 : 200), NULL)).type != + GRPC_QUEUE_TIMEOUT) { GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); read_tag = ((int)(gpr_intptr)ev.tag); gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index eecfa83fa4..2005e5f881 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -166,7 +166,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { cq_verifier_destroy(cqv); } -static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { +static void test_invoke_simple_request(grpc_end2end_test_config config, + size_t num_ops) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 3aa69ff996..b52d7067df 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -49,196 +49,190 @@ static void *tag(gpr_intptr t) { return (void *)t; } -const char *hobbits[][2] = { - {"Adaldrida", "Brandybuck"}, - {"Adamanta", "Took"}, - {"Adalgrim", "Took"}, - {"Adelard", "Took"}, - {"Amaranth", "Brandybuck"}, - {"Andwise", "Roper"}, - {"Angelica", "Baggins"}, - {"Asphodel", "Burrows"}, - {"Balbo", "Baggins"}, - {"Bandobras", "Took"}, - {"Belba", "Bolger"}, - {"Bell", "Gamgee"}, - {"Belladonna", "Baggins"}, - {"Berylla", "Baggins"}, - {"Bilbo", "Baggins"}, - {"Bilbo", "Gardner"}, - {"Bill", "Butcher"}, - {"Bingo", "Baggins"}, - {"Bodo", "Proudfoot"}, - {"Bowman", "Cotton"}, - {"Bungo", "Baggins"}, - {"Camellia", "Sackville"}, - {"Carl", "Cotton"}, - {"Celandine", "Brandybuck"}, - {"Chica", "Baggins"}, - {"Daddy", "Twofoot"}, - {"Daisy", "Boffin"}, - {"Diamond", "Took"}, - {"Dinodas", "Brandybuck"}, - {"Doderic", "Brandybuck"}, - {"Dodinas", "Brandybuck"}, - {"Donnamira", "Boffin"}, - {"Dora", "Baggins"}, - {"Drogo", "Baggins"}, - {"Dudo", "Baggins"}, - {"Eglantine", "Took"}, - {"Elanor", "Fairbairn"}, - {"Elfstan", "Fairbairn"}, - {"Esmeralda", "Brandybuck"}, - {"Estella", "Brandybuck"}, - {"Everard", "Took"}, - {"Falco", "Chubb-Baggins"}, - {"Faramir", "Took"}, - {"Farmer", "Maggot"}, - {"Fastolph", "Bolger"}, - {"Ferdibrand", "Took"}, - {"Ferdinand", "Took"}, - {"Ferumbras", "Took"}, - {"Ferumbras", "Took"}, - {"Filibert", "Bolger"}, - {"Firiel", "Fairbairn"}, - {"Flambard", "Took"}, - {"Folco", "Boffin"}, - {"Fortinbras", "Took"}, - {"Fortinbras", "Took"}, - {"Fosco", "Baggins"}, - {"Fredegar", "Bolger"}, - {"Frodo", "Baggins"}, - {"Frodo", "Gardner"}, - {"Gerontius", "Took"}, - {"Gilly", "Baggins"}, - {"Goldilocks", "Took"}, - {"Gorbadoc", "Brandybuck"}, - {"Gorbulas", "Brandybuck"}, - {"Gorhendad", "Brandybuck"}, - {"Gormadoc", "Brandybuck"}, - {"Griffo", "Boffin"}, - {"Halfast", "Gamgee"}, - {"Halfred", "Gamgee"}, - {"Halfred", "Greenhand"}, - {"Hanna", "Brandybuck"}, - {"Hamfast", "Gamgee"}, - {"Hamfast", "Gardner"}, - {"Hamson", "Gamgee"}, - {"Harding", "Gardner"}, - {"Hilda", "Brandybuck"}, - {"Hildibrand", "Took"}, - {"Hildifons", "Took"}, - {"Hildigard", "Took"}, - {"Hildigrim", "Took"}, - {"Hob", "Gammidge"}, - {"Hob", "Hayward"}, - {"Hobson", "Gamgee"}, - {"Holfast", "Gardner"}, - {"Holman", "Cotton"}, - {"Holman", "Greenhand"}, - {"Hugo", "Boffin"}, - {"Hugo", "Bracegirdle"}, - {"Ilberic", "Brandybuck"}, - {"Isembard", "Took"}, - {"Isembold", "Took"}, - {"Isengar", "Took"}, - {"Isengrim", "Took"}, - {"Isengrim", "Took"}, - {"Isumbras", "Took"}, - {"Isumbras", "Took"}, - {"Jolly", "Cotton"}, - {"Lalia", "Took"}, - {"Largo", "Baggins"}, - {"Laura", "Baggins"}, - {"Lily", "Goodbody"}, - {"Lily", "Cotton"}, - {"Linda", "Proudfoot"}, - {"Lobelia", "Sackville-Baggins"}, - {"Longo", "Baggins"}, - {"Lotho", "Sackville-Baggins"}, - {"Madoc", "Brandybuck"}, - {"Malva", "Brandybuck"}, - {"Marigold", "Cotton"}, - {"Marmadas", "Brandybuck"}, - {"Marmadoc", "Brandybuck"}, - {"Marroc", "Brandybuck"}, - {"May", "Gamgee"}, - {"Melilot", "Brandybuck"}, - {"Menegilda", "Brandybuck"}, - {"Mentha", "Brandybuck"}, - {"Meriadoc", "Brandybuck"}, - {"Merimac", "Brandybuck"}, - {"Merimas", "Brandybuck"}, - {"Merry", "Gardner"}, - {"Milo", "Burrows"}, - {"Mimosa", "Baggins"}, - {"Minto", "Burrows"}, - {"Mirabella", "Brandybuck"}, - {"Moro", "Burrows"}, - {"Mosco", "Burrows"}, - {"Mungo", "Baggins"}, - {"Myrtle", "Burrows"}, - {"Odo", "Proudfoot"}, - {"Odovacar", "Bolger"}, - {"Olo", "Proudfoot"}, - {"Orgulas", "Brandybuck"}, - {"Otho", "Sackville-Baggins"}, - {"Paladin", "Took"}, - {"Pansy", "Bolger"}, - {"Pearl", "Took"}, - {"Peony", "Burrows"}, - {"Peregrin", "Took"}, - {"Pervinca", "Took"}, - {"Pimpernel", "Took"}, - {"Pippin", "Gardner"}, - {"Polo", "Baggins"}, - {"Ponto", "Baggins"}, - {"Porto", "Baggins"}, - {"Posco", "Baggins"}, - {"Poppy", "Bolger"}, - {"Primrose", "Gardner"}, - {"Primula", "Baggins"}, - {"Prisca", "Bolger"}, - {"Reginard", "Took"}, - {"Robin", "Smallburrow"}, - {"Robin", "Gardner"}, - {"Rorimac", "Brandybuck"}, - {"Rosa", "Took"}, - {"Rosamunda", "Bolger"}, - {"Rose", "Gardner"}, - {"Ruby", "Baggins"}, - {"Ruby", "Gardner"}, - {"Rudigar", "Bolger"}, - {"Rufus", "Burrows"}, - {"Sadoc", "Brandybuck"}, - {"Salvia", "Bolger"}, - {"Samwise", "Gamgee"}, - {"Sancho", "Proudfoot"}, - {"Saradas", "Brandybuck"}, - {"Saradoc", "Brandybuck"}, - {"Seredic", "Brandybuck"}, - {"Sigismond", "Took"}, - {"Smeagol", "Gollum"}, - {"Tanta", "Baggins"}, - {"Ted", "Sandyman"}, - {"Tobold", "Hornblower"}, - {"Togo", "Goodbody"}, - {"Tolman", "Cotton"}, - {"Tolman", "Gardner"}, - {"Widow", "Rumble"}, - {"Wilcome", "Cotton"}, - {"Wilcome", "Cotton"}, - {"Wilibald", "Bolger"}, - {"Will", "Whitfoot"}, - {"Wiseman", "Gamwich"} -}; - -const char *dragons[] = { - "Ancalagon", - "Glaurung", - "Scatha", - "Smaug the Magnificent" -}; +const char *hobbits[][2] = {{"Adaldrida", "Brandybuck"}, + {"Adamanta", "Took"}, + {"Adalgrim", "Took"}, + {"Adelard", "Took"}, + {"Amaranth", "Brandybuck"}, + {"Andwise", "Roper"}, + {"Angelica", "Baggins"}, + {"Asphodel", "Burrows"}, + {"Balbo", "Baggins"}, + {"Bandobras", "Took"}, + {"Belba", "Bolger"}, + {"Bell", "Gamgee"}, + {"Belladonna", "Baggins"}, + {"Berylla", "Baggins"}, + {"Bilbo", "Baggins"}, + {"Bilbo", "Gardner"}, + {"Bill", "Butcher"}, + {"Bingo", "Baggins"}, + {"Bodo", "Proudfoot"}, + {"Bowman", "Cotton"}, + {"Bungo", "Baggins"}, + {"Camellia", "Sackville"}, + {"Carl", "Cotton"}, + {"Celandine", "Brandybuck"}, + {"Chica", "Baggins"}, + {"Daddy", "Twofoot"}, + {"Daisy", "Boffin"}, + {"Diamond", "Took"}, + {"Dinodas", "Brandybuck"}, + {"Doderic", "Brandybuck"}, + {"Dodinas", "Brandybuck"}, + {"Donnamira", "Boffin"}, + {"Dora", "Baggins"}, + {"Drogo", "Baggins"}, + {"Dudo", "Baggins"}, + {"Eglantine", "Took"}, + {"Elanor", "Fairbairn"}, + {"Elfstan", "Fairbairn"}, + {"Esmeralda", "Brandybuck"}, + {"Estella", "Brandybuck"}, + {"Everard", "Took"}, + {"Falco", "Chubb-Baggins"}, + {"Faramir", "Took"}, + {"Farmer", "Maggot"}, + {"Fastolph", "Bolger"}, + {"Ferdibrand", "Took"}, + {"Ferdinand", "Took"}, + {"Ferumbras", "Took"}, + {"Ferumbras", "Took"}, + {"Filibert", "Bolger"}, + {"Firiel", "Fairbairn"}, + {"Flambard", "Took"}, + {"Folco", "Boffin"}, + {"Fortinbras", "Took"}, + {"Fortinbras", "Took"}, + {"Fosco", "Baggins"}, + {"Fredegar", "Bolger"}, + {"Frodo", "Baggins"}, + {"Frodo", "Gardner"}, + {"Gerontius", "Took"}, + {"Gilly", "Baggins"}, + {"Goldilocks", "Took"}, + {"Gorbadoc", "Brandybuck"}, + {"Gorbulas", "Brandybuck"}, + {"Gorhendad", "Brandybuck"}, + {"Gormadoc", "Brandybuck"}, + {"Griffo", "Boffin"}, + {"Halfast", "Gamgee"}, + {"Halfred", "Gamgee"}, + {"Halfred", "Greenhand"}, + {"Hanna", "Brandybuck"}, + {"Hamfast", "Gamgee"}, + {"Hamfast", "Gardner"}, + {"Hamson", "Gamgee"}, + {"Harding", "Gardner"}, + {"Hilda", "Brandybuck"}, + {"Hildibrand", "Took"}, + {"Hildifons", "Took"}, + {"Hildigard", "Took"}, + {"Hildigrim", "Took"}, + {"Hob", "Gammidge"}, + {"Hob", "Hayward"}, + {"Hobson", "Gamgee"}, + {"Holfast", "Gardner"}, + {"Holman", "Cotton"}, + {"Holman", "Greenhand"}, + {"Hugo", "Boffin"}, + {"Hugo", "Bracegirdle"}, + {"Ilberic", "Brandybuck"}, + {"Isembard", "Took"}, + {"Isembold", "Took"}, + {"Isengar", "Took"}, + {"Isengrim", "Took"}, + {"Isengrim", "Took"}, + {"Isumbras", "Took"}, + {"Isumbras", "Took"}, + {"Jolly", "Cotton"}, + {"Lalia", "Took"}, + {"Largo", "Baggins"}, + {"Laura", "Baggins"}, + {"Lily", "Goodbody"}, + {"Lily", "Cotton"}, + {"Linda", "Proudfoot"}, + {"Lobelia", "Sackville-Baggins"}, + {"Longo", "Baggins"}, + {"Lotho", "Sackville-Baggins"}, + {"Madoc", "Brandybuck"}, + {"Malva", "Brandybuck"}, + {"Marigold", "Cotton"}, + {"Marmadas", "Brandybuck"}, + {"Marmadoc", "Brandybuck"}, + {"Marroc", "Brandybuck"}, + {"May", "Gamgee"}, + {"Melilot", "Brandybuck"}, + {"Menegilda", "Brandybuck"}, + {"Mentha", "Brandybuck"}, + {"Meriadoc", "Brandybuck"}, + {"Merimac", "Brandybuck"}, + {"Merimas", "Brandybuck"}, + {"Merry", "Gardner"}, + {"Milo", "Burrows"}, + {"Mimosa", "Baggins"}, + {"Minto", "Burrows"}, + {"Mirabella", "Brandybuck"}, + {"Moro", "Burrows"}, + {"Mosco", "Burrows"}, + {"Mungo", "Baggins"}, + {"Myrtle", "Burrows"}, + {"Odo", "Proudfoot"}, + {"Odovacar", "Bolger"}, + {"Olo", "Proudfoot"}, + {"Orgulas", "Brandybuck"}, + {"Otho", "Sackville-Baggins"}, + {"Paladin", "Took"}, + {"Pansy", "Bolger"}, + {"Pearl", "Took"}, + {"Peony", "Burrows"}, + {"Peregrin", "Took"}, + {"Pervinca", "Took"}, + {"Pimpernel", "Took"}, + {"Pippin", "Gardner"}, + {"Polo", "Baggins"}, + {"Ponto", "Baggins"}, + {"Porto", "Baggins"}, + {"Posco", "Baggins"}, + {"Poppy", "Bolger"}, + {"Primrose", "Gardner"}, + {"Primula", "Baggins"}, + {"Prisca", "Bolger"}, + {"Reginard", "Took"}, + {"Robin", "Smallburrow"}, + {"Robin", "Gardner"}, + {"Rorimac", "Brandybuck"}, + {"Rosa", "Took"}, + {"Rosamunda", "Bolger"}, + {"Rose", "Gardner"}, + {"Ruby", "Baggins"}, + {"Ruby", "Gardner"}, + {"Rudigar", "Bolger"}, + {"Rufus", "Burrows"}, + {"Sadoc", "Brandybuck"}, + {"Salvia", "Bolger"}, + {"Samwise", "Gamgee"}, + {"Sancho", "Proudfoot"}, + {"Saradas", "Brandybuck"}, + {"Saradoc", "Brandybuck"}, + {"Seredic", "Brandybuck"}, + {"Sigismond", "Took"}, + {"Smeagol", "Gollum"}, + {"Tanta", "Baggins"}, + {"Ted", "Sandyman"}, + {"Tobold", "Hornblower"}, + {"Togo", "Goodbody"}, + {"Tolman", "Cotton"}, + {"Tolman", "Gardner"}, + {"Widow", "Rumble"}, + {"Wilcome", "Cotton"}, + {"Wilcome", "Cotton"}, + {"Wilibald", "Bolger"}, + {"Will", "Whitfoot"}, + {"Wiseman", "Gamwich"}}; + +const char *dragons[] = {"Ancalagon", "Glaurung", "Scatha", + "Smaug the Magnificent"}; static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, const char *test_name, @@ -406,7 +400,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t index) { cq_verifier_destroy(cqv); } -static void test_size(grpc_end2end_test_config config, int encode_size, int decode_size) { +static void test_size(grpc_end2end_test_config config, int encode_size, + int decode_size) { size_t i; grpc_end2end_test_fixture f; grpc_arg server_arg; @@ -428,7 +423,8 @@ static void test_size(grpc_end2end_test_config config, int encode_size, int deco client_args.args = &client_arg; gpr_asprintf(&name, "test_size:e=%d:d=%d", encode_size, decode_size); - f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL, decode_size != 4096 ? &server_args : NULL); + f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL, + decode_size != 4096 ? &server_args : NULL); for (i = 0; i < 4 * GPR_ARRAY_SIZE(hobbits); i++) { simple_request_body(f, i); } @@ -439,24 +435,9 @@ static void test_size(grpc_end2end_test_config config, int encode_size, int deco void grpc_end2end_tests(grpc_end2end_test_config config) { static const int interesting_sizes[] = { - 4096, - 0, - 1, - 32, - 100, - 1000, - 4095, - 4097, - 8192, - 16384, - 32768, - 1024*1024-1, - 1024*1024, - 1024*1024+1, - 2*1024*1024, - 3*1024*1024, - 4*1024*1024 - }; + 4096, 0, 1, 32, 100, 1000, 4095, 4097, 8192, 16384, 32768, + 1024 * 1024 - 1, 1024 * 1024, 1024 * 1024 + 1, 2 * 1024 * 1024, + 3 * 1024 * 1024, 4 * 1024 * 1024}; size_t i, j; for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) { diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index abcc1ba358..8fe9e7bcc5 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -163,7 +163,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { cq_verifier_destroy(cqv); } -static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { +static void test_invoke_simple_request(grpc_end2end_test_config config, + size_t num_ops) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index 7a2d894481..dd1544c27b 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.c +++ b/test/core/network_benchmarks/low_level_ping_pong.c @@ -139,7 +139,7 @@ static int poll_read_bytes(int fd, char *buf, size_t read_size, int spin) { gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno)); return -1; } - bytes_read += (size_t) err2; + bytes_read += (size_t)err2; } while (bytes_read < read_size); return 0; } @@ -174,11 +174,11 @@ static int epoll_read_bytes(struct thread_args *args, char *buf, int spin) { GPR_ASSERT(ev.data.fd == args->fds.read_fd); do { do { - err2 = read(args->fds.read_fd, buf + bytes_read, - read_size - bytes_read); + err2 = + read(args->fds.read_fd, buf + bytes_read, read_size - bytes_read); } while (err2 < 0 && errno == EINTR); if (errno == EAGAIN) break; - bytes_read += (size_t) err2; + bytes_read += (size_t)err2; /* TODO(klempner): This should really be doing an extra call after we are done to ensure we see an EAGAIN */ } while (bytes_read < read_size); diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index 7f9cd6b62b..6b41698717 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -185,8 +185,8 @@ static void test_byte_buffer_from_reader(void) { } static void test_readall(void) { - char* lotsa_as[512]; - char* lotsa_bs[1024]; + char *lotsa_as[512]; + char *lotsa_bs[1024]; gpr_slice slices[2]; grpc_byte_buffer *buffer; grpc_byte_buffer_reader reader; diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index 2e336aa854..db55c27783 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -145,7 +145,8 @@ static void test_many_additions(void) { for (i = 0; i < 1000000; i++) { gpr_asprintf(&key, "K:%d", i); gpr_asprintf(&value, "VALUE:%d", i); - GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, key, value))); + GPR_ASSERT(grpc_chttp2_hptbl_add( + &tbl, grpc_mdelem_from_strings(mdctx, key, value))); assert_index(&tbl, 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY, key, value); gpr_free(key); gpr_free(value); @@ -182,9 +183,12 @@ static void test_find(void) { mdctx = grpc_mdctx_create(); grpc_chttp2_hptbl_init(&tbl, mdctx); - GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "xyz"))); - GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "abc", "123"))); - GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "x", "1"))); + GPR_ASSERT(grpc_chttp2_hptbl_add( + &tbl, grpc_mdelem_from_strings(mdctx, "abc", "xyz"))); + GPR_ASSERT(grpc_chttp2_hptbl_add( + &tbl, grpc_mdelem_from_strings(mdctx, "abc", "123"))); + GPR_ASSERT( + grpc_chttp2_hptbl_add(&tbl, grpc_mdelem_from_strings(mdctx, "x", "1"))); r = find_simple(&tbl, "abc", "123"); GPR_ASSERT(r.index == 2 + GRPC_CHTTP2_LAST_STATIC_ENTRY); @@ -233,8 +237,8 @@ static void test_find(void) { /* overflow the string buffer, check find still works */ for (i = 0; i < 10000; i++) { gpr_ltoa(i, buffer); - GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, - grpc_mdelem_from_strings(mdctx, "test", buffer))); + GPR_ASSERT(grpc_chttp2_hptbl_add( + &tbl, grpc_mdelem_from_strings(mdctx, "test", buffer))); } r = find_simple(&tbl, "abc", "123"); diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index f4400692fe..b24a90adac 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -181,29 +181,29 @@ class Client { std::unique_ptr<RandomDist> random_dist; switch (load.load_case()) { - case LoadParams::kClosedLoop: - // Closed-loop doesn't use random dist at all - break; - case LoadParams::kPoisson: - random_dist.reset( - new ExpDist(load.poisson().offered_load() / num_threads)); - break; - case LoadParams::kUniform: - random_dist.reset( - new UniformDist(load.uniform().interarrival_lo() * num_threads, - load.uniform().interarrival_hi() * num_threads)); - break; - case LoadParams::kDeterm: - random_dist.reset( - new DetDist(num_threads / load.determ().offered_load())); - break; - case LoadParams::kPareto: - random_dist.reset( - new ParetoDist(load.pareto().interarrival_base() * num_threads, - load.pareto().alpha())); - break; - default: - GPR_ASSERT(false); + case LoadParams::kClosedLoop: + // Closed-loop doesn't use random dist at all + break; + case LoadParams::kPoisson: + random_dist.reset( + new ExpDist(load.poisson().offered_load() / num_threads)); + break; + case LoadParams::kUniform: + random_dist.reset( + new UniformDist(load.uniform().interarrival_lo() * num_threads, + load.uniform().interarrival_hi() * num_threads)); + break; + case LoadParams::kDeterm: + random_dist.reset( + new DetDist(num_threads / load.determ().offered_load())); + break; + case LoadParams::kPareto: + random_dist.reset( + new ParetoDist(load.pareto().interarrival_base() * num_threads, + load.pareto().alpha())); + break; + default: + GPR_ASSERT(false); } // Set closed_loop_ based on whether or not random_dist is set |