Skip to content
Snippets Groups Projects
Commit 8b2f1d7a authored by Craig Tiller's avatar Craig Tiller
Browse files

Bug fixes, spam cleanup

parent 3255b3ca
Branches
Tags
No related merge requests found
...@@ -154,6 +154,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( ...@@ -154,6 +154,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
if (cur == end) { if (cur == end) {
parser->state = GRPC_CHTTP2_SPS_ID0; parser->state = GRPC_CHTTP2_SPS_ID0;
if (is_last) { if (is_last) {
transport_parsing->settings_updated = 1;
memcpy(parser->target_settings, parser->incoming_settings, memcpy(parser->target_settings, parser->incoming_settings,
GRPC_CHTTP2_NUM_SETTINGS * sizeof(gpr_uint32)); GRPC_CHTTP2_NUM_SETTINGS * sizeof(gpr_uint32));
gpr_slice_buffer_add(&transport_parsing->qbuf, gpr_slice_buffer_add(&transport_parsing->qbuf,
...@@ -231,7 +232,8 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( ...@@ -231,7 +232,8 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
} }
parser->incoming_settings[parser->id] = parser->value; parser->incoming_settings[parser->id] = parser->value;
if (grpc_http_trace) { if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id, gpr_log(GPR_DEBUG, "CHTTP2:%s: got setting %d = %d",
transport_parsing->is_client ? "CLI" : "SVR", parser->id,
parser->value); parser->value);
} }
} else { } else {
... ...
......
...@@ -334,6 +334,8 @@ struct grpc_chttp2_transport { ...@@ -334,6 +334,8 @@ struct grpc_chttp2_transport {
/** closure to execute writing */ /** closure to execute writing */
grpc_iomgr_closure writing_action; grpc_iomgr_closure writing_action;
/** closure to start reading from the endpoint */
grpc_iomgr_closure reading_action;
/** address to place a newly accepted stream - set and unset by /** address to place a newly accepted stream - set and unset by
grpc_chttp2_parsing_accept_stream; used by init_stream to grpc_chttp2_parsing_accept_stream; used by init_stream to
... ...
......
...@@ -194,7 +194,6 @@ void grpc_chttp2_publish_reads( ...@@ -194,7 +194,6 @@ void grpc_chttp2_publish_reads(
stream_global->outgoing_window += stream_parsing->outgoing_window_update; stream_global->outgoing_window += stream_parsing->outgoing_window_update;
stream_parsing->outgoing_window_update = 0; stream_parsing->outgoing_window_update = 0;
is_zero = stream_global->outgoing_window <= 0; is_zero = stream_global->outgoing_window <= 0;
gpr_log(GPR_DEBUG, "was=%d is=%d", was_zero, is_zero);
if (was_zero && !is_zero) { if (was_zero && !is_zero) {
grpc_chttp2_list_add_writable_stream(transport_global, stream_global); grpc_chttp2_list_add_writable_stream(transport_global, stream_global);
} }
...@@ -765,8 +764,6 @@ static int init_settings_frame_parser( ...@@ -765,8 +764,6 @@ static int init_settings_frame_parser(
} }
if (transport_parsing->incoming_frame_flags & GRPC_CHTTP2_FLAG_ACK) { if (transport_parsing->incoming_frame_flags & GRPC_CHTTP2_FLAG_ACK) {
transport_parsing->settings_ack_received = 1; transport_parsing->settings_ack_received = 1;
} else {
transport_parsing->settings_updated = 1;
} }
transport_parsing->parser = grpc_chttp2_settings_parser_parse; transport_parsing->parser = grpc_chttp2_settings_parser_parse;
transport_parsing->parser_data = &transport_parsing->simple.settings; transport_parsing->parser_data = &transport_parsing->simple.settings;
... ...
......
...@@ -111,7 +111,7 @@ void grpc_chttp2_stream_map_move_into(grpc_chttp2_stream_map *src, ...@@ -111,7 +111,7 @@ void grpc_chttp2_stream_map_move_into(grpc_chttp2_stream_map *src,
if (dst->count + src->count > dst->capacity) { if (dst->count + src->count > dst->capacity) {
dst->capacity = GPR_MAX(dst->capacity * 3 / 2, dst->count + src->count); dst->capacity = GPR_MAX(dst->capacity * 3 / 2, dst->count + src->count);
dst->keys = gpr_realloc(dst->keys, dst->capacity * sizeof(gpr_uint32)); dst->keys = gpr_realloc(dst->keys, dst->capacity * sizeof(gpr_uint32));
dst->values = gpr_realloc(dst->values, dst->capacity * sizeof(gpr_uint32)); dst->values = gpr_realloc(dst->values, dst->capacity * sizeof(void *));
} }
/* the first element of src must be greater than the last of dst */ /* the first element of src must be greater than the last of dst */
GPR_ASSERT(src->keys[0] > dst->keys[dst->count - 1]); GPR_ASSERT(src->keys[0] > dst->keys[dst->count - 1]);
... ...
......
...@@ -84,11 +84,6 @@ int grpc_chttp2_unlocking_check_writes( ...@@ -84,11 +84,6 @@ int grpc_chttp2_unlocking_check_writes(
transport_global->outgoing_window -= window_delta; transport_global->outgoing_window -= window_delta;
stream_global->outgoing_window -= window_delta; stream_global->outgoing_window -= window_delta;
gpr_log(GPR_DEBUG, "%s ws:%d nops:%d rc:%d",
transport_global->is_client ? "CLI" : "SVR",
stream_global->write_state, stream_global->outgoing_sopb->nops,
stream_global->read_closed);
if (stream_global->write_state == WRITE_STATE_QUEUED_CLOSE && if (stream_global->write_state == WRITE_STATE_QUEUED_CLOSE &&
stream_global->outgoing_sopb->nops == 0) { stream_global->outgoing_sopb->nops == 0) {
if (!transport_global->is_client && !stream_global->read_closed) { if (!transport_global->is_client && !stream_global->read_closed) {
...@@ -178,9 +173,6 @@ static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) { ...@@ -178,9 +173,6 @@ static void finalize_outbuf(grpc_chttp2_transport_writing *transport_writing) {
while ( while (
grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) { grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) {
gpr_log(GPR_DEBUG, "%s write %d: sc=%d",
transport_writing->is_client ? "CLI" : "SVR", stream_writing->id,
stream_writing->send_closed);
grpc_chttp2_encode(stream_writing->sopb.ops, stream_writing->sopb.nops, grpc_chttp2_encode(stream_writing->sopb.ops, stream_writing->sopb.nops,
stream_writing->send_closed != DONT_SEND_CLOSED, stream_writing->send_closed != DONT_SEND_CLOSED,
stream_writing->id, &transport_writing->hpack_compressor, stream_writing->id, &transport_writing->hpack_compressor,
... ...
......
...@@ -86,6 +86,7 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t); ...@@ -86,6 +86,7 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t);
/* forward declarations of various callbacks that we'll build closures around */ /* forward declarations of various callbacks that we'll build closures around */
static void writing_action(void *t, int iomgr_success_ignored); static void writing_action(void *t, int iomgr_success_ignored);
static void reading_action(void *t, int iomgr_success_ignored);
static void notify_closed(void *t, int iomgr_success_ignored); static void notify_closed(void *t, int iomgr_success_ignored);
/** Set a transport level setting, and push it to our peer */ /** Set a transport level setting, and push it to our peer */
...@@ -237,6 +238,7 @@ static void init_transport(grpc_chttp2_transport *t, ...@@ -237,6 +238,7 @@ static void init_transport(grpc_chttp2_transport *t,
gpr_slice_buffer_init(&t->writing.outbuf); gpr_slice_buffer_init(&t->writing.outbuf);
grpc_chttp2_hpack_compressor_init(&t->writing.hpack_compressor, mdctx); grpc_chttp2_hpack_compressor_init(&t->writing.hpack_compressor, mdctx);
grpc_iomgr_closure_init(&t->writing_action, writing_action, t); grpc_iomgr_closure_init(&t->writing_action, writing_action, t);
grpc_iomgr_closure_init(&t->reading_action, reading_action, t);
gpr_slice_buffer_init(&t->parsing.qbuf); gpr_slice_buffer_init(&t->parsing.qbuf);
grpc_chttp2_goaway_parser_init(&t->parsing.goaway_parser); grpc_chttp2_goaway_parser_init(&t->parsing.goaway_parser);
...@@ -560,7 +562,6 @@ void grpc_chttp2_add_incoming_goaway( ...@@ -560,7 +562,6 @@ void grpc_chttp2_add_incoming_goaway(
grpc_chttp2_transport_global *transport_global, gpr_uint32 goaway_error, grpc_chttp2_transport_global *transport_global, gpr_uint32 goaway_error,
gpr_slice goaway_text) { gpr_slice goaway_text) {
char *msg = gpr_hexdump((char*)GPR_SLICE_START_PTR(goaway_text), GPR_SLICE_LENGTH(goaway_text), GPR_HEXDUMP_PLAINTEXT); char *msg = gpr_hexdump((char*)GPR_SLICE_START_PTR(goaway_text), GPR_SLICE_LENGTH(goaway_text), GPR_HEXDUMP_PLAINTEXT);
gpr_log(GPR_DEBUG, "add goaway: st=%d err=%d text=%s", transport_global->goaway_state, goaway_error, msg);
gpr_free(msg); gpr_free(msg);
if (transport_global->goaway_state == GRPC_CHTTP2_ERROR_STATE_NONE) { if (transport_global->goaway_state == GRPC_CHTTP2_ERROR_STATE_NONE) {
transport_global->goaway_state = GRPC_CHTTP2_ERROR_STATE_SEEN; transport_global->goaway_state = GRPC_CHTTP2_ERROR_STATE_SEEN;
...@@ -574,7 +575,6 @@ void grpc_chttp2_add_incoming_goaway( ...@@ -574,7 +575,6 @@ void grpc_chttp2_add_incoming_goaway(
static void maybe_start_some_streams( static void maybe_start_some_streams(
grpc_chttp2_transport_global *transport_global) { grpc_chttp2_transport_global *transport_global) {
grpc_chttp2_stream_global *stream_global; grpc_chttp2_stream_global *stream_global;
gpr_log(GPR_DEBUG, "nextid=%d count=%d", transport_global->next_stream_id, transport_global->concurrent_stream_count);
/* start streams where we have free grpc_chttp2_stream ids and free /* start streams where we have free grpc_chttp2_stream ids and free
* concurrency */ * concurrency */
while (transport_global->next_stream_id <= MAX_CLIENT_STREAM_ID && while (transport_global->next_stream_id <= MAX_CLIENT_STREAM_ID &&
...@@ -784,28 +784,18 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t) { ...@@ -784,28 +784,18 @@ static void unlock_check_read_write_state(grpc_chttp2_transport *t) {
if (stream_global->write_state == WRITE_STATE_SENT_CLOSE && if (stream_global->write_state == WRITE_STATE_SENT_CLOSE &&
stream_global->read_closed && stream_global->in_stream_map) { stream_global->read_closed && stream_global->in_stream_map) {
if (t->parsing_active) { if (t->parsing_active) {
gpr_log(GPR_DEBUG, "%s %d: queue wait for close",
transport_global->is_client ? "CLI" : "SVR", stream_global->id);
grpc_chttp2_list_add_closed_waiting_for_parsing(transport_global, grpc_chttp2_list_add_closed_waiting_for_parsing(transport_global,
stream_global); stream_global);
} else { } else {
gpr_log(GPR_DEBUG, "%s %d: late removal from map",
transport_global->is_client ? "CLI" : "SVR", stream_global->id);
remove_stream(t, stream_global->id); remove_stream(t, stream_global->id);
} }
} }
if (!stream_global->publish_sopb) { if (!stream_global->publish_sopb) {
gpr_log(GPR_DEBUG, "%s %d: skip rw update: no publish target",
transport_global->is_client ? "CLI" : "SVR", stream_global->id);
continue; continue;
} }
state = compute_state( state = compute_state(
stream_global->write_state == WRITE_STATE_SENT_CLOSE, stream_global->write_state == WRITE_STATE_SENT_CLOSE,
stream_global->read_closed && !stream_global->in_stream_map); stream_global->read_closed && !stream_global->in_stream_map);
gpr_log(GPR_DEBUG, "%s %d: state=%d->%d; nops=%d",
transport_global->is_client ? "CLI" : "SVR", stream_global->id,
stream_global->published_state, state,
stream_global->incoming_sopb.nops);
if (stream_global->incoming_sopb.nops == 0 && if (stream_global->incoming_sopb.nops == 0 &&
state == stream_global->published_state) { state == stream_global->published_state) {
continue; continue;
...@@ -1021,7 +1011,7 @@ static void recv_data(void *tp, gpr_slice *slices, size_t nslices, ...@@ -1021,7 +1011,7 @@ static void recv_data(void *tp, gpr_slice *slices, size_t nslices,
t->parsing_active = 0; t->parsing_active = 0;
} }
if (i == nslices) { if (i == nslices) {
grpc_endpoint_notify_on_read(t->ep, recv_data, t); grpc_chttp2_schedule_closure(&t->global, &t->reading_action, 1);
} }
unlock(t); unlock(t);
for (; i < nslices; i++) gpr_slice_unref(slices[i]); for (; i < nslices; i++) gpr_slice_unref(slices[i]);
...@@ -1029,6 +1019,11 @@ static void recv_data(void *tp, gpr_slice *slices, size_t nslices, ...@@ -1029,6 +1019,11 @@ static void recv_data(void *tp, gpr_slice *slices, size_t nslices,
} }
} }
static void reading_action(void *pt, int iomgr_success_ignored) {
grpc_chttp2_transport *t = pt;
grpc_endpoint_notify_on_read(t->ep, recv_data, t);
}
/* /*
* CALLBACK LOOP * CALLBACK LOOP
*/ */
...@@ -1144,7 +1139,7 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *reason, ...@@ -1144,7 +1139,7 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *reason,
} else { } else {
identifier = gpr_strdup(context_scope); identifier = gpr_strdup(context_scope);
} }
gpr_log(GPR_DEBUG, gpr_log(GPR_INFO,
"FLOWCTL: %s %-10s %8s %-23s %8lld %c %8lld = %8lld %-10s [%s:%d]", "FLOWCTL: %s %-10s %8s %-23s %8lld %c %8lld = %8lld %-10s [%s:%d]",
is_client ? "client" : "server", identifier, context_thread, var, is_client ? "client" : "server", identifier, context_thread, var,
current_value, delta < 0 ? '-' : '+', delta < 0 ? -delta : delta, current_value, delta < 0 ? '-' : '+', delta < 0 ? -delta : delta,
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment