Clean up unused variables and funcs

pull/9626/head
Muxi Yan 8 years ago
parent a3fda8fdc9
commit 848073f77d
  1. 8
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  2. 33
      src/core/ext/transport/chttp2/transport/frame_data.c
  3. 5
      src/core/ext/transport/chttp2/transport/internal.h
  4. 3
      test/cpp/microbenchmarks/bm_chttp2_transport.cc

@ -2624,8 +2624,6 @@ static grpc_error *deframe_unprocessed_incoming_frames(
static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs) {
if (gpr_unref(&bs->refs)) {
grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices);
gpr_mu_destroy(&bs->slice_mu);
gpr_free(bs);
}
}
@ -2844,11 +2842,9 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished(
grpc_chttp2_stream *s = bs->stream;
if (error == GRPC_ERROR_NONE) {
gpr_mu_lock(&bs->slice_mu);
if (bs->remaining_bytes != 0) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
}
gpr_mu_unlock(&bs->slice_mu);
}
if (error != GRPC_ERROR_NONE && reset_on_error) {
grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
@ -2869,15 +2865,11 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create(
incoming_byte_stream->base.next = incoming_byte_stream_next;
incoming_byte_stream->base.pull = incoming_byte_stream_pull;
incoming_byte_stream->base.destroy = incoming_byte_stream_destroy;
gpr_mu_init(&incoming_byte_stream->slice_mu);
gpr_ref_init(&incoming_byte_stream->refs, 2);
incoming_byte_stream->next_message = NULL;
incoming_byte_stream->transport = t;
incoming_byte_stream->stream = s;
grpc_slice_buffer_init(&incoming_byte_stream->slices);
incoming_byte_stream->is_tail = 1;
s->byte_stream_error = GRPC_ERROR_NONE;
incoming_byte_stream->push_closed = false;
return incoming_byte_stream;
}

@ -84,39 +84,6 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser,
return GRPC_ERROR_NONE;
}
void grpc_chttp2_incoming_frame_queue_merge(
grpc_chttp2_incoming_frame_queue *head_dst,
grpc_chttp2_incoming_frame_queue *tail_src) {
if (tail_src->head == NULL) {
return;
}
if (head_dst->head == NULL) {
*head_dst = *tail_src;
memset(tail_src, 0, sizeof(*tail_src));
return;
}
head_dst->tail->next_message = tail_src->head;
head_dst->tail = tail_src->tail;
memset(tail_src, 0, sizeof(*tail_src));
}
grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop(
grpc_chttp2_incoming_frame_queue *q) {
grpc_byte_stream *out;
if (q->head == NULL) {
return NULL;
}
out = &q->head->base;
if (q->head == q->tail) {
memset(q, 0, sizeof(*q));
} else {
q->head = q->head->next_message;
}
return out;
}
void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,

@ -195,16 +195,11 @@ typedef struct grpc_chttp2_write_cb {
struct grpc_chttp2_incoming_byte_stream {
grpc_byte_stream base;
gpr_refcount refs;
struct grpc_chttp2_incoming_byte_stream
*next_message; /* unused; should be removed */
bool push_closed; /* protected by slice_mu */
grpc_chttp2_transport *transport; /* immutable */
grpc_chttp2_stream *stream; /* immutable */
bool is_tail; /* immutable */
gpr_mu slice_mu;
grpc_slice_buffer slices; /* unused; should be removed */
uint32_t remaining_bytes; /* guaranteed one thread access */
struct {

@ -575,8 +575,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) {
GRPC_ERROR_NONE ==
grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) &&
(received += GRPC_SLICE_LENGTH(recv_slice),
grpc_slice_unref_internal(exec_ctx, recv_slice),
true));
grpc_slice_unref_internal(exec_ctx, recv_slice), true));
});
drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) {

Loading…
Cancel
Save