diff options
author | 2016-03-30 16:58:32 -0700 | |
---|---|---|
committer | 2016-03-30 16:58:32 -0700 | |
commit | 98d53f67686ef87ff08b00b1fdd1e12343030391 (patch) | |
tree | 42a6677781a59104ad5ec9fa74685f6b03eb29a2 /src/core/ext/transport/chttp2/transport/hpack_encoder.c | |
parent | 1a6293f0969bb940b7db0ec5f763cf75c2d28f56 (diff) | |
parent | 90da73714eac582686736c48d113bdfc75b15169 (diff) |
Merge remote-tracking branch 'upstream/master' into hpack_table
Diffstat (limited to 'src/core/ext/transport/chttp2/transport/hpack_encoder.c')
-rw-r--r-- | src/core/ext/transport/chttp2/transport/hpack_encoder.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index ef89f1ce19..8f62372ce7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -75,6 +75,7 @@ typedef struct { /* output stream id */ uint32_t stream_id; gpr_slice_buffer *output; + grpc_transport_one_way_stats *stats; } framer_state; /* fills p (which is expected to be 9 bytes long) with a data frame header */ @@ -103,6 +104,7 @@ static void finish_frame(framer_state *st, int is_header_boundary, st->stream_id, st->output->length - st->output_length_at_start_of_frame, (uint8_t)((is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) | (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0))); + st->stats->framing_bytes += 9; st->is_first_frame = 0; } @@ -148,8 +150,10 @@ static void add_header_data(framer_state *st, gpr_slice slice) { remaining = GRPC_CHTTP2_MAX_PAYLOAD_LENGTH + st->output_length_at_start_of_frame - st->output->length; if (len <= remaining) { + st->stats->header_bytes += len; gpr_slice_buffer_add(st->output, slice); } else { + st->stats->header_bytes += remaining; gpr_slice_buffer_add(st->output, gpr_slice_split_head(&slice, remaining)); finish_frame(st, 0, 0); begin_frame(st); @@ -534,6 +538,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t stream_id, grpc_metadata_batch *metadata, int is_eof, + grpc_transport_one_way_stats *stats, gpr_slice_buffer *outbuf) { framer_state st; grpc_linked_mdelem *l; @@ -545,6 +550,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, st.stream_id = stream_id; st.output = outbuf; st.is_first_frame = 1; + st.stats = stats; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata |