Stats collection pipeline

pull/5699/head
Craig Tiller 9 years ago
parent 466129eb24
commit f1262ce7e7
  1. 25
      src/core/transport/chttp2/frame_data.c
  2. 4
      src/core/transport/chttp2/frame_data.h
  3. 5
      src/core/transport/chttp2/frame_rst_stream.c
  4. 6
      src/core/transport/chttp2/frame_rst_stream.h
  5. 9
      src/core/transport/chttp2/frame_window_update.c
  6. 6
      src/core/transport/chttp2/frame_window_update.h
  7. 6
      src/core/transport/chttp2/hpack_encoder.c
  8. 8
      src/core/transport/chttp2/hpack_encoder.h
  9. 5
      src/core/transport/chttp2/hpack_parser.c
  10. 4
      src/core/transport/chttp2/internal.h
  11. 34
      src/core/transport/chttp2/parsing.c
  12. 34
      src/core/transport/chttp2/writing.c
  13. 6
      src/core/transport/chttp2_transport.c
  14. 13
      test/core/transport/chttp2/hpack_encoder_test.c

@ -35,11 +35,11 @@
#include <string.h>
#include "src/core/transport/chttp2/internal.h"
#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/internal.h"
#include "src/core/transport/transport.h"
grpc_chttp2_parse_error grpc_chttp2_data_parser_init(
@ -113,6 +113,7 @@ grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop(
void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,
gpr_slice_buffer *outbuf) {
gpr_slice hdr;
uint8_t *p;
@ -132,6 +133,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
gpr_slice_buffer_add(outbuf, hdr);
gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf);
stats->framing_bytes += 9;
stats->data_bytes += write_bytes;
}
grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
@ -156,6 +160,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
switch (p->state) {
fh_0:
case GRPC_CHTTP2_DATA_FH_0:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_type = *cur;
switch (p->frame_type) {
case 0:
@ -174,6 +179,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
/* fallthrough */
case GRPC_CHTTP2_DATA_FH_1:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_size = ((uint32_t)*cur) << 24;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_2;
@ -181,6 +187,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
/* fallthrough */
case GRPC_CHTTP2_DATA_FH_2:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_size |= ((uint32_t)*cur) << 16;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_3;
@ -188,6 +195,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
/* fallthrough */
case GRPC_CHTTP2_DATA_FH_3:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_size |= ((uint32_t)*cur) << 8;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_4;
@ -195,6 +203,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
/* fallthrough */
case GRPC_CHTTP2_DATA_FH_4:
stream_parsing->stats.incoming.framing_bytes++;
p->frame_size |= ((uint32_t)*cur);
p->state = GRPC_CHTTP2_DATA_FRAME;
++cur;
@ -215,7 +224,9 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
}
grpc_chttp2_list_add_parsing_seen_stream(transport_parsing,
stream_parsing);
if ((uint32_t)(end - cur) == p->frame_size) {
uint32_t remaining = (uint32_t)(end - cur);
if (remaining == p->frame_size) {
stream_parsing->stats.incoming.data_bytes += p->frame_size;
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
@ -224,7 +235,8 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
p->parsing_frame = NULL;
p->state = GRPC_CHTTP2_DATA_FH_0;
return GRPC_CHTTP2_PARSE_OK;
} else if ((uint32_t)(end - cur) > p->frame_size) {
} else if (remaining > p->frame_size) {
stream_parsing->stats.incoming.data_bytes += p->frame_size;
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
gpr_slice_sub(slice, (size_t)(cur - beg),
@ -235,11 +247,12 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
cur += p->frame_size;
goto fh_0; /* loop */
} else {
GPR_ASSERT(remaining <= p->frame_size);
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
GPR_ASSERT((size_t)(end - cur) <= p->frame_size);
p->frame_size -= (uint32_t)(end - cur);
p->frame_size -= remaining;
stream_parsing->stats.incoming.data_bytes += remaining;
return GRPC_CHTTP2_PARSE_OK;
}
}

@ -36,11 +36,12 @@
/* Parser for GRPC streams embedded in DATA frames */
#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
#include "src/core/iomgr/exec_ctx.h"
#include "src/core/transport/byte_stream.h"
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/transport.h"
typedef enum {
GRPC_CHTTP2_DATA_FH_0,
@ -96,6 +97,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse(
void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,
gpr_slice_buffer *outbuf);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_DATA_H */

@ -38,8 +38,10 @@
#include "src/core/transport/chttp2/frame.h"
gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code) {
gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
grpc_transport_one_way_stats *stats) {
gpr_slice slice = gpr_slice_malloc(13);
stats->framing_bytes += 13;
uint8_t *p = GPR_SLICE_START_PTR(slice);
*p++ = 0;
@ -84,6 +86,7 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse(
cur++;
p->byte++;
}
stream_parsing->stats.incoming.framing_bytes += (uint64_t)(end - cur);
if (p->byte == 4) {
GPR_ASSERT(is_last);

@ -35,15 +35,17 @@
#define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H
#include <grpc/support/slice.h>
#include "src/core/transport/chttp2/frame.h"
#include "src/core/iomgr/exec_ctx.h"
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/transport.h"
typedef struct {
uint8_t byte;
uint8_t reason_bytes[4];
} grpc_chttp2_rst_stream_parser;
gpr_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code);
gpr_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_transport_one_way_stats *stats);
grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags);

@ -36,9 +36,10 @@
#include <grpc/support/log.h>
gpr_slice grpc_chttp2_window_update_create(uint32_t id,
uint32_t window_update) {
gpr_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) {
gpr_slice slice = gpr_slice_malloc(13);
stats->header_bytes += 13;
uint8_t *p = GPR_SLICE_START_PTR(slice);
GPR_ASSERT(window_update);
@ -87,6 +88,10 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse(
p->byte++;
}
if (stream_parsing != NULL) {
stream_parsing->stats.incoming.framing_bytes += (uint32_t)(end - cur);
}
if (p->byte == 4) {
uint32_t received_update = p->amount;
if (received_update == 0 || (received_update & 0x80000000u)) {

@ -34,9 +34,10 @@
#ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
#define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice.h>
#include "src/core/iomgr/exec_ctx.h"
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/transport.h"
typedef struct {
uint8_t byte;
@ -44,7 +45,8 @@ typedef struct {
uint32_t amount;
} grpc_chttp2_window_update_parser;
gpr_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta);
gpr_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta,
grpc_transport_one_way_stats *stats);
grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_window_update_parser *parser, uint32_t length, uint8_t flags);

@ -74,6 +74,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 */
@ -102,6 +103,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;
}
@ -147,8 +149,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);
@ -535,6 +539,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;
@ -546,6 +551,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

@ -34,12 +34,13 @@
#ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H
#define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/metadata.h"
#include "src/core/transport/metadata_batch.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/metadata.h"
#include "src/core/transport/metadata_batch.h"
#include "src/core/transport/transport.h"
#define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256
#define GRPC_CHTTP2_HPACKC_NUM_VALUES 256
@ -90,6 +91,7 @@ void grpc_chttp2_hpack_compressor_set_max_usable_size(
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t id,
grpc_metadata_batch *metadata, int is_eof,
grpc_transport_one_way_stats *stats,
gpr_slice_buffer *outbuf);
#endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H */

@ -34,9 +34,9 @@
#include "src/core/transport/chttp2/hpack_parser.h"
#include "src/core/transport/chttp2/internal.h"
#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <assert.h>
/* This is here for grpc_is_binary_header
* TODO(murgatroid99): Remove this
@ -1412,6 +1412,9 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse(
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) {
grpc_chttp2_hpack_parser *parser = hpack_parser;
GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0);
if (stream_parsing != NULL) {
stream_parsing->stats.incoming.header_bytes += GPR_SLICE_LENGTH(slice);
}
if (!grpc_chttp2_hpack_parser_parse(parser, GPR_SLICE_START_PTR(slice),
GPR_SLICE_END_PTR(slice))) {
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);

@ -438,6 +438,8 @@ typedef struct {
gpr_slice fetching_slice;
size_t stream_fetched;
grpc_closure finished_fetch;
/** stats gathered during the write */
grpc_transport_one_way_stats stats;
} grpc_chttp2_stream_writing;
struct grpc_chttp2_stream_parsing {
@ -463,6 +465,8 @@ struct grpc_chttp2_stream_parsing {
int64_t outgoing_window;
/** number of bytes received - reset at end of parse thread execution */
int64_t received_bytes;
/** stats gathered during the parse */
grpc_transport_stream_stats stats;
/** incoming metadata */
grpc_chttp2_incoming_metadata_buffer metadata_buffer[2];

@ -171,6 +171,9 @@ void grpc_chttp2_publish_reads(
grpc_chttp2_list_add_check_read_ops(transport_global, stream_global);
}
/* flush stats to global stream state */
grpc_transport_move_stats(&stream_parsing->stats, &stream_global->stats);
/* update outgoing flow control window */
was_zero = stream_global->outgoing_window <= 0;
GRPC_CHTTP2_FLOW_MOVE_STREAM("parsed", transport_global, stream_global,
@ -544,8 +547,13 @@ static int init_data_frame_parser(
grpc_chttp2_parsing_lookup_stream(transport_parsing,
transport_parsing->incoming_stream_id);
grpc_chttp2_parse_error err = GRPC_CHTTP2_PARSE_OK;
if (!stream_parsing || stream_parsing->received_close)
if (stream_parsing == NULL) {
return init_skip_frame_parser(exec_ctx, transport_parsing, 0);
}
stream_parsing->stats.incoming.framing_bytes += 9;
if (stream_parsing->received_close) {
return init_skip_frame_parser(exec_ctx, transport_parsing, 0);
}
if (err == GRPC_CHTTP2_PARSE_OK) {
err = update_incoming_window(exec_ctx, transport_parsing, stream_parsing);
}
@ -566,7 +574,8 @@ static int init_data_frame_parser(
gpr_slice_buffer_add(
&transport_parsing->qbuf,
grpc_chttp2_rst_stream_create(transport_parsing->incoming_stream_id,
GRPC_CHTTP2_PROTOCOL_ERROR));
GRPC_CHTTP2_PROTOCOL_ERROR,
&stream_parsing->stats.outgoing));
return init_skip_frame_parser(exec_ctx, transport_parsing, 0);
case GRPC_CHTTP2_CONNECTION_ERROR:
return 0;
@ -717,6 +726,7 @@ static int init_header_frame_parser(
transport_parsing->incoming_stream = stream_parsing;
}
GPR_ASSERT(stream_parsing != NULL && (via_accept == 0 || via_accept == 1));
stream_parsing->stats.incoming.framing_bytes += 9;
if (stream_parsing->received_close) {
gpr_log(GPR_ERROR, "skipping already closed grpc_chttp2_stream header");
transport_parsing->incoming_stream = NULL;
@ -752,9 +762,14 @@ static int init_window_update_frame_parser(
&transport_parsing->simple.window_update,
transport_parsing->incoming_frame_size,
transport_parsing->incoming_frame_flags);
if (transport_parsing->incoming_stream_id) {
transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream(
transport_parsing, transport_parsing->incoming_stream_id);
if (transport_parsing->incoming_stream_id != 0) {
grpc_chttp2_stream_parsing *stream_parsing =
transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream(
transport_parsing, transport_parsing->incoming_stream_id);
if (stream_parsing == NULL) {
return init_skip_frame_parser(exec_ctx, transport_parsing, 0);
}
stream_parsing->stats.incoming.framing_bytes += 9;
}
transport_parsing->parser = grpc_chttp2_window_update_parser_parse;
transport_parsing->parser_data = &transport_parsing->simple.window_update;
@ -778,11 +793,13 @@ static int init_rst_stream_parser(
&transport_parsing->simple.rst_stream,
transport_parsing->incoming_frame_size,
transport_parsing->incoming_frame_flags);
transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream(
transport_parsing, transport_parsing->incoming_stream_id);
grpc_chttp2_stream_parsing *stream_parsing =
transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream(
transport_parsing, transport_parsing->incoming_stream_id);
if (!transport_parsing->incoming_stream) {
return init_skip_frame_parser(exec_ctx, transport_parsing, 0);
}
stream_parsing->stats.incoming.framing_bytes += 9;
transport_parsing->parser = grpc_chttp2_rst_stream_parser_parse;
transport_parsing->parser_data = &transport_parsing->simple.rst_stream;
return ok;
@ -856,7 +873,8 @@ static int parse_frame_slice(grpc_exec_ctx *exec_ctx,
gpr_slice_buffer_add(
&transport_parsing->qbuf,
grpc_chttp2_rst_stream_create(transport_parsing->incoming_stream_id,
GRPC_CHTTP2_PROTOCOL_ERROR));
GRPC_CHTTP2_PROTOCOL_ERROR,
&stream_parsing->stats.outgoing));
}
return 1;
case GRPC_CHTTP2_CONNECTION_ERROR:

@ -161,8 +161,10 @@ int grpc_chttp2_unlocking_check_writes(
transport_global->announce_incoming_window, UINT32_MAX);
GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("write", transport_global,
announce_incoming_window, announced);
gpr_slice_buffer_add(&transport_writing->outbuf,
grpc_chttp2_window_update_create(0, announced));
grpc_transport_one_way_stats throwaway_stats;
gpr_slice_buffer_add(
&transport_writing->outbuf,
grpc_chttp2_window_update_create(0, announced, &throwaway_stats));
}
GPR_TIMER_END("grpc_chttp2_unlocking_check_writes", 0);
@ -205,7 +207,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
if (stream_writing->send_initial_metadata != NULL) {
grpc_chttp2_encode_header(
&transport_writing->hpack_compressor, stream_writing->id,
stream_writing->send_initial_metadata, 0, &transport_writing->outbuf);
stream_writing->send_initial_metadata, 0, &stream_writing->stats,
&transport_writing->outbuf);
stream_writing->send_initial_metadata = NULL;
stream_writing->sent_initial_metadata = 1;
}
@ -216,7 +219,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
gpr_slice_buffer_add(
&transport_writing->outbuf,
grpc_chttp2_window_update_create(stream_writing->id,
stream_writing->announce_window));
stream_writing->announce_window,
&stream_writing->stats));
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing, stream_writing,
announce_window, announce);
stream_writing->announce_window = 0;
@ -255,7 +259,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
stream_writing->send_trailing_metadata);
grpc_chttp2_encode_data(
stream_writing->id, &stream_writing->flow_controlled_buffer,
send_bytes, is_last_frame, &transport_writing->outbuf);
send_bytes, is_last_frame, &stream_writing->stats,
&transport_writing->outbuf);
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing,
stream_writing, outgoing_window,
send_bytes);
@ -281,19 +286,20 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
stream_writing->send_trailing_metadata != NULL) {
if (grpc_metadata_batch_is_empty(
stream_writing->send_trailing_metadata)) {
grpc_chttp2_encode_data(stream_writing->id,
&stream_writing->flow_controlled_buffer, 0, 1,
&transport_writing->outbuf);
grpc_chttp2_encode_data(
stream_writing->id, &stream_writing->flow_controlled_buffer, 0, 1,
&stream_writing->stats, &transport_writing->outbuf);
} else {
grpc_chttp2_encode_header(&transport_writing->hpack_compressor,
stream_writing->id,
stream_writing->send_trailing_metadata, 1,
&transport_writing->outbuf);
grpc_chttp2_encode_header(
&transport_writing->hpack_compressor, stream_writing->id,
stream_writing->send_trailing_metadata, 1, &stream_writing->stats,
&transport_writing->outbuf);
}
if (!transport_writing->is_client && !stream_writing->read_closed) {
gpr_slice_buffer_add(&transport_writing->outbuf,
grpc_chttp2_rst_stream_create(
stream_writing->id, GRPC_CHTTP2_NO_ERROR));
stream_writing->id, GRPC_CHTTP2_NO_ERROR,
&stream_writing->stats));
}
stream_writing->send_trailing_metadata = NULL;
stream_writing->sent_trailing_metadata = 1;
@ -331,6 +337,8 @@ void grpc_chttp2_cleanup_writing(
exec_ctx, stream_global,
&stream_global->send_initial_metadata_finished, 1);
}
grpc_transport_move_one_way_stats(&stream_writing->stats,
&stream_global->stats.outgoing);
if (stream_writing->sent_message) {
GPR_ASSERT(stream_writing->send_message == NULL);
grpc_chttp2_complete_closure_step(

@ -1150,7 +1150,8 @@ static void cancel_from_api(grpc_exec_ctx *exec_ctx,
&transport_global->qbuf,
grpc_chttp2_rst_stream_create(
stream_global->id,
(uint32_t)grpc_chttp2_grpc_status_to_http2_error(status)));
(uint32_t)grpc_chttp2_grpc_status_to_http2_error(status),
&stream_global->stats.outgoing));
}
grpc_chttp2_fake_status(exec_ctx, transport_global, stream_global, status,
NULL);
@ -1340,7 +1341,8 @@ static void close_from_api(grpc_exec_ctx *exec_ctx,
gpr_slice_buffer_add(
&transport_global->qbuf,
grpc_chttp2_rst_stream_create(stream_global->id, GRPC_CHTTP2_NO_ERROR));
grpc_chttp2_rst_stream_create(stream_global->id, GRPC_CHTTP2_NO_ERROR,
&stream_global->stats.outgoing));
if (optional_message) {
gpr_slice_ref(*optional_message);

@ -34,13 +34,15 @@
#include "src/core/transport/chttp2/hpack_encoder.h"
#include <stdio.h>
#include <string.h>
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/hpack_parser.h"
#include "src/core/transport/metadata.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/hpack_parser.h"
#include "src/core/transport/metadata.h"
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
@ -93,7 +95,10 @@ static void verify(size_t window_available, int eof, size_t expect_window_used,
gpr_slice_buffer_init(&output);
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, &output);
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, &stats,
&output);
merged = grpc_slice_merge(output.slices, output.count);
gpr_slice_buffer_destroy(&output);
grpc_metadata_batch_destroy(&b);

Loading…
Cancel
Save