Small fixes

pull/6897/head
Craig Tiller 9 years ago
parent ba1bb87675
commit 71f9665612
  1. 6
      src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
  2. 44
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  3. 13
      src/core/ext/transport/chttp2/transport/frame_data.c
  4. 4
      src/core/ext/transport/chttp2/transport/internal.h
  5. 4
      src/core/lib/surface/server.c

@ -159,8 +159,10 @@ error:
done:
grpc_exec_ctx_finish(&exec_ctx);
for (i = 0; i < naddrs; i++) {
GRPC_ERROR_UNREF(errors[i]);
if (errors != NULL) {
for (i = 0; i < naddrs; i++) {
GRPC_ERROR_UNREF(errors[i]);
}
}
GRPC_ERROR_UNREF(err);
gpr_free(errors);

@ -1942,12 +1942,27 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx,
sizeof(arg));
}
typedef struct {
grpc_chttp2_incoming_byte_stream *bs;
grpc_error *error;
} bs_fail_args;
static bs_fail_args *make_bs_fail_args(grpc_chttp2_incoming_byte_stream *bs,
grpc_error *error) {
bs_fail_args *a = gpr_malloc(sizeof(*a));
a->bs = bs;
a->error = error;
return a;
}
static void incoming_byte_stream_finished_failed_locked(
grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s,
void *argp) {
grpc_chttp2_incoming_byte_stream *bs = argp;
grpc_error *error = argp;
grpc_exec_ctx_push(exec_ctx, bs->on_next, GRPC_ERROR_REF(error), NULL);
bs_fail_args *a = argp;
grpc_chttp2_incoming_byte_stream *bs = a->bs;
grpc_error *error = a->error;
gpr_free(a);
grpc_exec_ctx_push(exec_ctx, bs->on_next, error, NULL);
bs->on_next = NULL;
bs->error = error;
incoming_byte_stream_unref(exec_ctx, bs);
@ -1962,25 +1977,26 @@ static void incoming_byte_stream_finished_ok_locked(grpc_exec_ctx *exec_ctx,
}
void grpc_chttp2_incoming_byte_stream_finished(
grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, int success,
int from_parsing_thread) {
grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs,
grpc_error *error, int from_parsing_thread) {
if (from_parsing_thread) {
if (success) {
if (error == GRPC_ERROR_NONE) {
grpc_chttp2_run_with_global_lock(exec_ctx, bs->transport, bs->stream,
incoming_byte_stream_finished_ok_locked,
bs, 0);
} else {
incoming_byte_stream_finished_ok_locked(exec_ctx, bs->transport,
bs->stream, bs);
}
} else {
if (success) {
grpc_chttp2_run_with_global_lock(
exec_ctx, bs->transport, bs->stream,
incoming_byte_stream_finished_failed_locked, bs, 0);
incoming_byte_stream_finished_failed_locked,
make_bs_fail_args(bs, error), 0);
}
} else {
if (error == GRPC_ERROR_NONE) {
incoming_byte_stream_finished_ok_locked(exec_ctx, bs->transport,
bs->stream, bs);
} else {
incoming_byte_stream_finished_failed_locked(exec_ctx, bs->transport,
bs->stream, bs);
incoming_byte_stream_finished_failed_locked(
exec_ctx, bs->transport, bs->stream, make_bs_fail_args(bs, error));
}
}
}

@ -53,8 +53,9 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
grpc_chttp2_data_parser *parser) {
grpc_byte_stream *bs;
if (parser->parsing_frame) {
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, parser->parsing_frame,
0, 1);
grpc_chttp2_incoming_byte_stream_finished(
exec_ctx, parser->parsing_frame, GRPC_ERROR_CREATE("Parser destroyed"),
1);
}
while (
(bs = grpc_chttp2_incoming_frame_queue_pop(&parser->incoming_frames))) {
@ -249,8 +250,8 @@ grpc_error *grpc_chttp2_data_parser_parse(
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, 1,
1);
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
GRPC_ERROR_NONE, 1);
p->parsing_frame = NULL;
p->state = GRPC_CHTTP2_DATA_FH_0;
return GRPC_ERROR_NONE;
@ -260,8 +261,8 @@ grpc_error *grpc_chttp2_data_parser_parse(
exec_ctx, p->parsing_frame,
gpr_slice_sub(slice, (size_t)(cur - beg),
(size_t)(cur + p->frame_size - beg)));
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, 1,
1);
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
GRPC_ERROR_NONE, 1);
p->parsing_frame = NULL;
cur += p->frame_size;
goto fh_0; /* loop */

@ -809,8 +809,8 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs,
gpr_slice slice);
void grpc_chttp2_incoming_byte_stream_finished(
grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, int success,
int from_parsing_thread);
grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs,
grpc_error *error, int from_parsing_thread);
void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_parsing *parsing,

@ -299,10 +299,12 @@ static void channel_broadcaster_shutdown(grpc_exec_ctx *exec_ctx,
size_t i;
for (i = 0; i < cb->num_channels; i++) {
send_shutdown(exec_ctx, cb->channels[i], send_goaway, force_disconnect);
send_shutdown(exec_ctx, cb->channels[i], send_goaway,
GRPC_ERROR_REF(force_disconnect));
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, cb->channels[i], "broadcast");
}
gpr_free(cb->channels);
GRPC_ERROR_UNREF(force_disconnect);
}
/*

Loading…
Cancel
Save