grpc 1.16.0 → 1.17.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +299 -133
- data/include/grpc/grpc.h +11 -1
- data/include/grpc/grpc_posix.h +0 -8
- data/include/grpc/impl/codegen/grpc_types.h +3 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +336 -345
- data/src/core/ext/filters/client_channel/client_channel.h +6 -2
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +3 -1
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +0 -7
- data/src/core/ext/filters/client_channel/health/health.pb.c +23 -0
- data/src/core/ext/filters/client_channel/health/health.pb.h +73 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +652 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.h +173 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -1
- data/src/core/ext/filters/client_channel/http_proxy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +17 -14
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +15 -11
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +21 -15
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +18 -10
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +12 -9
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1832 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +36 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +36 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +107 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +85 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +72 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +307 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +89 -0
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +5 -0
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +4 -0
- data/src/core/ext/filters/client_channel/parse_address.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +19 -22
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +41 -39
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +3 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +4 -1
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +15 -2
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +5 -1
- data/src/core/ext/filters/client_channel/resolver_factory.h +1 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +384 -0
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +146 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +361 -103
- data/src/core/ext/filters/client_channel/subchannel.h +14 -8
- data/src/core/ext/filters/deadline/deadline_filter.cc +19 -23
- data/src/core/ext/filters/deadline/deadline_filter.h +9 -13
- data/src/core/ext/filters/http/client/http_client_filter.cc +29 -19
- data/src/core/ext/filters/http/client_authority_filter.cc +2 -3
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +28 -16
- data/src/core/ext/filters/http/server/http_server_filter.cc +31 -20
- data/src/core/ext/filters/message_size/message_size_filter.cc +50 -45
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -6
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +58 -8
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +175 -173
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +4 -10
- data/src/core/ext/transport/chttp2/transport/frame_data.h +10 -12
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +28 -25
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +0 -12
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +12 -9
- data/src/core/ext/transport/chttp2/transport/internal.h +109 -94
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -2
- data/src/core/ext/transport/inproc/inproc_transport.cc +280 -300
- data/src/core/lib/channel/channel_stack.cc +5 -4
- data/src/core/lib/channel/channel_stack.h +4 -4
- data/src/core/lib/channel/channel_stack_builder.cc +14 -2
- data/src/core/lib/channel/channel_stack_builder.h +8 -0
- data/src/core/lib/channel/channel_trace.cc +6 -2
- data/src/core/lib/channel/channelz.cc +137 -5
- data/src/core/lib/channel/channelz.h +32 -6
- data/src/core/lib/channel/channelz_registry.cc +134 -28
- data/src/core/lib/channel/channelz_registry.h +25 -3
- data/src/core/lib/channel/context.h +4 -4
- data/src/core/lib/channel/handshaker.cc +7 -6
- data/src/core/lib/channel/handshaker.h +7 -8
- data/src/core/lib/channel/handshaker_factory.cc +3 -2
- data/src/core/lib/channel/handshaker_factory.h +2 -0
- data/src/core/lib/channel/handshaker_registry.cc +6 -2
- data/src/core/lib/channel/handshaker_registry.h +1 -0
- data/src/core/lib/gpr/arena.cc +84 -37
- data/src/core/lib/gpr/arena.h +2 -0
- data/src/core/lib/gpr/mpscq.h +4 -2
- data/src/core/lib/gprpp/inlined_vector.h +8 -0
- data/src/core/lib/gprpp/ref_counted.h +105 -18
- data/src/core/lib/gprpp/ref_counted_ptr.h +11 -0
- data/src/core/lib/http/httpcli_security_connector.cc +7 -4
- data/src/core/lib/iomgr/call_combiner.cc +2 -0
- data/src/core/lib/iomgr/call_combiner.h +2 -2
- data/src/core/lib/iomgr/closure.h +1 -0
- data/src/core/lib/iomgr/error.cc +16 -31
- data/src/core/lib/iomgr/error.h +29 -4
- data/src/core/lib/iomgr/error_internal.h +0 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +7 -3
- data/src/core/lib/iomgr/ev_posix.cc +0 -2
- data/src/core/lib/iomgr/polling_entity.h +4 -4
- data/src/core/lib/iomgr/resource_quota.cc +64 -10
- data/src/core/lib/iomgr/resource_quota.h +21 -6
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +11 -5
- data/src/core/lib/iomgr/tcp_client_custom.cc +14 -3
- data/src/core/lib/iomgr/tcp_client_posix.cc +2 -0
- data/src/core/lib/iomgr/tcp_posix.cc +4 -2
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +3 -4
- data/src/core/lib/security/context/security_context.cc +20 -13
- data/src/core/lib/security/context/security_context.h +27 -19
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/credentials.h +2 -2
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +1 -0
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +39 -54
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +3 -2
- data/src/core/lib/security/credentials/local/local_credentials.cc +1 -1
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -2
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +2 -0
- data/src/core/lib/security/security_connector/{alts_security_connector.cc → alts/alts_security_connector.cc} +10 -9
- data/src/core/lib/security/security_connector/{alts_security_connector.h → alts/alts_security_connector.h} +3 -3
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +310 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +42 -0
- data/src/core/lib/security/security_connector/{local_security_connector.cc → local/local_security_connector.cc} +4 -3
- data/src/core/lib/security/security_connector/{local_security_connector.h → local/local_security_connector.h} +3 -3
- data/src/core/lib/security/security_connector/security_connector.cc +4 -1039
- data/src/core/lib/security/security_connector/security_connector.h +6 -114
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +474 -0
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +77 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +345 -0
- data/src/core/lib/security/security_connector/ssl_utils.h +93 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +28 -17
- data/src/core/lib/security/transport/secure_endpoint.cc +51 -41
- data/src/core/lib/security/transport/security_handshaker.cc +6 -7
- data/src/core/lib/security/transport/server_auth_filter.cc +39 -31
- data/src/core/lib/surface/call.cc +100 -80
- data/src/core/lib/surface/call.h +4 -0
- data/src/core/lib/surface/channel.cc +27 -13
- data/src/core/lib/surface/channel.h +4 -3
- data/src/core/lib/surface/completion_queue.cc +8 -1
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/server.cc +111 -46
- data/src/core/lib/surface/server.h +16 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/error_utils.cc +4 -2
- data/src/core/lib/transport/metadata.cc +3 -2
- data/src/core/lib/transport/metadata.h +3 -2
- data/src/core/lib/transport/metadata_batch.cc +1 -0
- data/src/core/lib/transport/metadata_batch.h +4 -2
- data/src/core/lib/transport/static_metadata.cc +225 -221
- data/src/core/lib/transport/static_metadata.h +74 -71
- data/src/core/lib/transport/transport.h +44 -26
- data/src/core/{ext/filters/client_channel → lib/uri}/uri_parser.cc +1 -1
- data/src/core/{ext/filters/client_channel → lib/uri}/uri_parser.h +3 -3
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -4
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +356 -77
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.h +46 -36
- data/src/core/tsi/alts/handshaker/alts_shared_resource.cc +83 -0
- data/src/core/tsi/alts/handshaker/alts_shared_resource.h +73 -0
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +122 -175
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +33 -22
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h +38 -10
- data/src/core/tsi/transport_security.cc +18 -1
- data/src/core/tsi/transport_security.h +2 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/pb/codegen/grpc/testing/package_options.proto +28 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -3
- metadata +58 -40
- data/src/core/ext/filters/client_channel/method_params.cc +0 -178
- data/src/core/ext/filters/client_channel/method_params.h +0 -78
- data/src/core/tsi/alts/handshaker/alts_tsi_event.cc +0 -75
- data/src/core/tsi/alts/handshaker/alts_tsi_event.h +0 -93
- data/src/core/tsi/alts_transport_security.cc +0 -65
- data/src/core/tsi/alts_transport_security.h +0 -47
@@ -32,7 +32,8 @@ extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount;
|
|
32
32
|
extern bool g_flow_control_enabled;
|
33
33
|
|
34
34
|
grpc_transport* grpc_create_chttp2_transport(
|
35
|
-
const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client
|
35
|
+
const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client,
|
36
|
+
grpc_resource_user* resource_user = nullptr);
|
36
37
|
|
37
38
|
intptr_t grpc_chttp2_transport_get_socket_uuid(grpc_transport* transport);
|
38
39
|
|
@@ -32,18 +32,12 @@
|
|
32
32
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
33
33
|
#include "src/core/lib/transport/transport.h"
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
return GRPC_ERROR_NONE;
|
39
|
-
}
|
40
|
-
|
41
|
-
void grpc_chttp2_data_parser_destroy(grpc_chttp2_data_parser* parser) {
|
42
|
-
if (parser->parsing_frame != nullptr) {
|
43
|
-
GRPC_ERROR_UNREF(parser->parsing_frame->Finished(
|
35
|
+
grpc_chttp2_data_parser::~grpc_chttp2_data_parser() {
|
36
|
+
if (parsing_frame != nullptr) {
|
37
|
+
GRPC_ERROR_UNREF(parsing_frame->Finished(
|
44
38
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false));
|
45
39
|
}
|
46
|
-
GRPC_ERROR_UNREF(
|
40
|
+
GRPC_ERROR_UNREF(error);
|
47
41
|
}
|
48
42
|
|
49
43
|
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
|
@@ -43,20 +43,18 @@ namespace grpc_core {
|
|
43
43
|
class Chttp2IncomingByteStream;
|
44
44
|
} // namespace grpc_core
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
uint32_t frame_size;
|
50
|
-
grpc_error* error;
|
46
|
+
struct grpc_chttp2_data_parser {
|
47
|
+
grpc_chttp2_data_parser() = default;
|
48
|
+
~grpc_chttp2_data_parser();
|
51
49
|
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
grpc_chttp2_stream_state state = GRPC_CHTTP2_DATA_FH_0;
|
51
|
+
uint8_t frame_type = 0;
|
52
|
+
uint32_t frame_size = 0;
|
53
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
void grpc_chttp2_data_parser_destroy(grpc_chttp2_data_parser* parser);
|
55
|
+
bool is_frame_compressed = false;
|
56
|
+
grpc_core::Chttp2IncomingByteStream* parsing_frame = nullptr;
|
57
|
+
};
|
60
58
|
|
61
59
|
/* start processing a new data frame */
|
62
60
|
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
|
@@ -32,7 +32,7 @@ grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
|
|
32
32
|
grpc_transport_one_way_stats* stats) {
|
33
33
|
static const size_t frame_size = 13;
|
34
34
|
grpc_slice slice = GRPC_SLICE_MALLOC(frame_size);
|
35
|
-
stats->framing_bytes += frame_size;
|
35
|
+
if (stats != nullptr) stats->framing_bytes += frame_size;
|
36
36
|
uint8_t* p = GRPC_SLICE_START_PTR(slice);
|
37
37
|
|
38
38
|
// Frame size.
|
@@ -212,10 +212,6 @@ static uint32_t prepare_space_for_new_elem(grpc_chttp2_hpack_compressor* c,
|
|
212
212
|
return new_index;
|
213
213
|
}
|
214
214
|
|
215
|
-
/* dummy function */
|
216
|
-
static void add_nothing(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
|
217
|
-
size_t elem_size) {}
|
218
|
-
|
219
215
|
// Add a key to the dynamic table. Both key and value will be added to table at
|
220
216
|
// the decoder.
|
221
217
|
static void add_key_with_index(grpc_chttp2_hpack_compressor* c,
|
@@ -524,17 +520,22 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
|
|
524
520
|
uint32_t indices_key;
|
525
521
|
|
526
522
|
/* should this elem be in the table? */
|
527
|
-
size_t decoder_space_usage =
|
523
|
+
const size_t decoder_space_usage =
|
528
524
|
grpc_chttp2_get_size_in_hpack_table(elem, st->use_true_binary_metadata);
|
529
|
-
bool should_add_elem = elem_interned &&
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
525
|
+
const bool should_add_elem = elem_interned &&
|
526
|
+
decoder_space_usage < MAX_DECODER_SPACE_USAGE &&
|
527
|
+
c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >=
|
528
|
+
c->filter_elems_sum / ONE_ON_ADD_PROBABILITY;
|
529
|
+
|
530
|
+
auto emit_maybe_add = [&should_add_elem, &elem, &st, &c, &indices_key,
|
531
|
+
&decoder_space_usage] {
|
532
|
+
if (should_add_elem) {
|
533
|
+
emit_lithdr_incidx(c, dynidx(c, indices_key), elem, st);
|
534
|
+
add_elem(c, elem, decoder_space_usage);
|
535
|
+
} else {
|
536
|
+
emit_lithdr_noidx(c, dynidx(c, indices_key), elem, st);
|
537
|
+
}
|
538
|
+
};
|
538
539
|
|
539
540
|
/* no hits for the elem... maybe there's a key? */
|
540
541
|
indices_key = c->indices_keys[HASH_FRAGMENT_2(key_hash)];
|
@@ -542,8 +543,7 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
|
|
542
543
|
GRPC_MDKEY(elem)) &&
|
543
544
|
indices_key > c->tail_remote_index) {
|
544
545
|
/* HIT: key (first cuckoo hash) */
|
545
|
-
|
546
|
-
maybe_add(c, elem, decoder_space_usage);
|
546
|
+
emit_maybe_add();
|
547
547
|
return;
|
548
548
|
}
|
549
549
|
|
@@ -552,20 +552,23 @@ static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
|
|
552
552
|
GRPC_MDKEY(elem)) &&
|
553
553
|
indices_key > c->tail_remote_index) {
|
554
554
|
/* HIT: key (first cuckoo hash) */
|
555
|
-
|
556
|
-
maybe_add(c, elem, decoder_space_usage);
|
555
|
+
emit_maybe_add();
|
557
556
|
return;
|
558
557
|
}
|
559
558
|
|
560
559
|
/* no elem, key in the table... fall back to literal emission */
|
561
|
-
bool should_add_key =
|
560
|
+
const bool should_add_key =
|
562
561
|
!elem_interned && decoder_space_usage < MAX_DECODER_SPACE_USAGE;
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
562
|
+
if (should_add_elem || should_add_key) {
|
563
|
+
emit_lithdr_incidx_v(c, 0, elem, st);
|
564
|
+
} else {
|
565
|
+
emit_lithdr_noidx_v(c, 0, elem, st);
|
566
|
+
}
|
567
|
+
if (should_add_elem) {
|
568
|
+
add_elem(c, elem, decoder_space_usage);
|
569
|
+
} else if (should_add_key) {
|
570
|
+
add_key(c, elem, decoder_space_usage);
|
571
|
+
}
|
569
572
|
}
|
570
573
|
|
571
574
|
#define STRLEN_LIT(x) (sizeof(x) - 1)
|
@@ -27,18 +27,6 @@
|
|
27
27
|
#include <grpc/support/alloc.h>
|
28
28
|
#include <grpc/support/log.h>
|
29
29
|
|
30
|
-
void grpc_chttp2_incoming_metadata_buffer_init(
|
31
|
-
grpc_chttp2_incoming_metadata_buffer* buffer, gpr_arena* arena) {
|
32
|
-
buffer->arena = arena;
|
33
|
-
grpc_metadata_batch_init(&buffer->batch);
|
34
|
-
buffer->batch.deadline = GRPC_MILLIS_INF_FUTURE;
|
35
|
-
}
|
36
|
-
|
37
|
-
void grpc_chttp2_incoming_metadata_buffer_destroy(
|
38
|
-
grpc_chttp2_incoming_metadata_buffer* buffer) {
|
39
|
-
grpc_metadata_batch_destroy(&buffer->batch);
|
40
|
-
}
|
41
|
-
|
42
30
|
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
|
43
31
|
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_mdelem elem) {
|
44
32
|
buffer->size += GRPC_MDELEM_LENGTH(elem);
|
@@ -23,17 +23,20 @@
|
|
23
23
|
|
24
24
|
#include "src/core/lib/transport/transport.h"
|
25
25
|
|
26
|
-
|
26
|
+
struct grpc_chttp2_incoming_metadata_buffer {
|
27
|
+
grpc_chttp2_incoming_metadata_buffer(gpr_arena* arena) : arena(arena) {
|
28
|
+
grpc_metadata_batch_init(&batch);
|
29
|
+
batch.deadline = GRPC_MILLIS_INF_FUTURE;
|
30
|
+
}
|
31
|
+
~grpc_chttp2_incoming_metadata_buffer() {
|
32
|
+
grpc_metadata_batch_destroy(&batch);
|
33
|
+
}
|
34
|
+
|
27
35
|
gpr_arena* arena;
|
28
36
|
grpc_metadata_batch batch;
|
29
|
-
size_t size; // total size of metadata
|
30
|
-
}
|
31
|
-
|
32
|
-
/** assumes everything initially zeroed */
|
33
|
-
void grpc_chttp2_incoming_metadata_buffer_init(
|
34
|
-
grpc_chttp2_incoming_metadata_buffer* buffer, gpr_arena* arena);
|
35
|
-
void grpc_chttp2_incoming_metadata_buffer_destroy(
|
36
|
-
grpc_chttp2_incoming_metadata_buffer* buffer);
|
37
|
+
size_t size = 0; // total size of metadata
|
38
|
+
};
|
39
|
+
|
37
40
|
void grpc_chttp2_incoming_metadata_buffer_publish(
|
38
41
|
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_metadata_batch* batch);
|
39
42
|
|
@@ -103,8 +103,8 @@ const char* grpc_chttp2_initiate_write_reason_string(
|
|
103
103
|
grpc_chttp2_initiate_write_reason reason);
|
104
104
|
|
105
105
|
typedef struct {
|
106
|
-
grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT];
|
107
|
-
uint64_t inflight_id;
|
106
|
+
grpc_closure_list lists[GRPC_CHTTP2_PCL_COUNT] = {};
|
107
|
+
uint64_t inflight_id = 0;
|
108
108
|
} grpc_chttp2_ping_queue;
|
109
109
|
|
110
110
|
typedef struct {
|
@@ -280,34 +280,41 @@ typedef enum {
|
|
280
280
|
} grpc_chttp2_keepalive_state;
|
281
281
|
|
282
282
|
struct grpc_chttp2_transport {
|
283
|
+
grpc_chttp2_transport(const grpc_channel_args* channel_args,
|
284
|
+
grpc_endpoint* ep, bool is_client,
|
285
|
+
grpc_resource_user* resource_user);
|
286
|
+
~grpc_chttp2_transport();
|
287
|
+
|
283
288
|
grpc_transport base; /* must be first */
|
284
289
|
gpr_refcount refs;
|
285
290
|
grpc_endpoint* ep;
|
286
291
|
char* peer_string;
|
287
292
|
|
293
|
+
grpc_resource_user* resource_user;
|
294
|
+
|
288
295
|
grpc_combiner* combiner;
|
289
296
|
|
290
|
-
grpc_closure* notify_on_receive_settings;
|
297
|
+
grpc_closure* notify_on_receive_settings = nullptr;
|
291
298
|
|
292
299
|
/** write execution state of the transport */
|
293
|
-
grpc_chttp2_write_state write_state;
|
300
|
+
grpc_chttp2_write_state write_state = GRPC_CHTTP2_WRITE_STATE_IDLE;
|
294
301
|
/** is this the first write in a series of writes?
|
295
302
|
set when we initiate writing from idle, cleared when we
|
296
303
|
initiate writing from writing+more */
|
297
|
-
bool is_first_write_in_batch;
|
304
|
+
bool is_first_write_in_batch = false;
|
298
305
|
|
299
306
|
/** is the transport destroying itself? */
|
300
|
-
uint8_t destroying;
|
307
|
+
uint8_t destroying = false;
|
301
308
|
/** has the upper layer closed the transport? */
|
302
|
-
grpc_error* closed_with_error;
|
309
|
+
grpc_error* closed_with_error = GRPC_ERROR_NONE;
|
303
310
|
|
304
311
|
/** is there a read request to the endpoint outstanding? */
|
305
|
-
uint8_t endpoint_reading;
|
312
|
+
uint8_t endpoint_reading = 1;
|
306
313
|
|
307
|
-
grpc_chttp2_optimization_target opt_target;
|
314
|
+
grpc_chttp2_optimization_target opt_target = GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY;
|
308
315
|
|
309
316
|
/** various lists of streams */
|
310
|
-
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT];
|
317
|
+
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT] = {};
|
311
318
|
|
312
319
|
/** maps stream id to grpc_chttp2_stream objects */
|
313
320
|
grpc_chttp2_stream_map stream_map;
|
@@ -324,7 +331,7 @@ struct grpc_chttp2_transport {
|
|
324
331
|
/** address to place a newly accepted stream - set and unset by
|
325
332
|
grpc_chttp2_parsing_accept_stream; used by init_stream to
|
326
333
|
publish the accepted server stream */
|
327
|
-
grpc_chttp2_stream** accepting_stream;
|
334
|
+
grpc_chttp2_stream** accepting_stream = nullptr;
|
328
335
|
|
329
336
|
struct {
|
330
337
|
/* accept stream callback */
|
@@ -348,41 +355,43 @@ struct grpc_chttp2_transport {
|
|
348
355
|
|
349
356
|
/** how much data are we willing to buffer when the WRITE_BUFFER_HINT is set?
|
350
357
|
*/
|
351
|
-
uint32_t write_buffer_size;
|
358
|
+
uint32_t write_buffer_size = grpc_core::chttp2::kDefaultWindow;
|
352
359
|
|
353
360
|
/** Set to a grpc_error object if a goaway frame is received. By default, set
|
354
361
|
* to GRPC_ERROR_NONE */
|
355
|
-
grpc_error* goaway_error;
|
362
|
+
grpc_error* goaway_error = GRPC_ERROR_NONE;
|
356
363
|
|
357
|
-
grpc_chttp2_sent_goaway_state sent_goaway_state;
|
364
|
+
grpc_chttp2_sent_goaway_state sent_goaway_state = GRPC_CHTTP2_NO_GOAWAY_SEND;
|
358
365
|
|
359
366
|
/** are the local settings dirty and need to be sent? */
|
360
|
-
bool dirtied_local_settings;
|
367
|
+
bool dirtied_local_settings = true;
|
361
368
|
/** have local settings been sent? */
|
362
|
-
bool sent_local_settings;
|
363
|
-
/** bitmask of setting indexes to send out
|
364
|
-
|
369
|
+
bool sent_local_settings = false;
|
370
|
+
/** bitmask of setting indexes to send out
|
371
|
+
Hack: it's common for implementations to assume 65536 bytes initial send
|
372
|
+
window -- this should by rights be 0 */
|
373
|
+
uint32_t force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
365
374
|
/** settings values */
|
366
375
|
uint32_t settings[GRPC_NUM_SETTING_SETS][GRPC_CHTTP2_NUM_SETTINGS];
|
367
376
|
|
368
377
|
/** what is the next stream id to be allocated by this peer?
|
369
378
|
copied to next_stream_id in parsing when parsing commences */
|
370
|
-
uint32_t next_stream_id;
|
379
|
+
uint32_t next_stream_id = 0;
|
371
380
|
|
372
381
|
/** last new stream id */
|
373
|
-
uint32_t last_new_stream_id;
|
382
|
+
uint32_t last_new_stream_id = 0;
|
374
383
|
|
375
384
|
/** ping queues for various ping insertion points */
|
376
|
-
grpc_chttp2_ping_queue ping_queue;
|
385
|
+
grpc_chttp2_ping_queue ping_queue = grpc_chttp2_ping_queue();
|
377
386
|
grpc_chttp2_repeated_ping_policy ping_policy;
|
378
387
|
grpc_chttp2_repeated_ping_state ping_state;
|
379
|
-
uint64_t ping_ctr; /* unique id for pings */
|
388
|
+
uint64_t ping_ctr = 0; /* unique id for pings */
|
380
389
|
grpc_closure retry_initiate_ping_locked;
|
381
390
|
|
382
391
|
/** ping acks */
|
383
|
-
size_t ping_ack_count;
|
384
|
-
size_t ping_ack_capacity;
|
385
|
-
uint64_t* ping_acks;
|
392
|
+
size_t ping_ack_count = 0;
|
393
|
+
size_t ping_ack_capacity = 0;
|
394
|
+
uint64_t* ping_acks = nullptr;
|
386
395
|
grpc_chttp2_server_ping_recv_state ping_recv_state;
|
387
396
|
|
388
397
|
/** parser for headers */
|
@@ -408,22 +417,22 @@ struct grpc_chttp2_transport {
|
|
408
417
|
int64_t initial_window_update = 0;
|
409
418
|
|
410
419
|
/* deframing */
|
411
|
-
grpc_chttp2_deframe_transport_state deframe_state;
|
412
|
-
uint8_t incoming_frame_type;
|
413
|
-
uint8_t incoming_frame_flags;
|
414
|
-
uint8_t header_eof;
|
415
|
-
bool is_first_frame;
|
416
|
-
uint32_t expect_continuation_stream_id;
|
417
|
-
uint32_t incoming_frame_size;
|
418
|
-
uint32_t incoming_stream_id;
|
420
|
+
grpc_chttp2_deframe_transport_state deframe_state = GRPC_DTS_CLIENT_PREFIX_0;
|
421
|
+
uint8_t incoming_frame_type = 0;
|
422
|
+
uint8_t incoming_frame_flags = 0;
|
423
|
+
uint8_t header_eof = 0;
|
424
|
+
bool is_first_frame = true;
|
425
|
+
uint32_t expect_continuation_stream_id = 0;
|
426
|
+
uint32_t incoming_frame_size = 0;
|
427
|
+
uint32_t incoming_stream_id = 0;
|
419
428
|
|
420
429
|
/* active parser */
|
421
|
-
void* parser_data;
|
422
|
-
grpc_chttp2_stream* incoming_stream;
|
430
|
+
void* parser_data = nullptr;
|
431
|
+
grpc_chttp2_stream* incoming_stream = nullptr;
|
423
432
|
grpc_error* (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
|
424
433
|
grpc_chttp2_stream* s, grpc_slice slice, int is_last);
|
425
434
|
|
426
|
-
grpc_chttp2_write_cb* write_cb_pool;
|
435
|
+
grpc_chttp2_write_cb* write_cb_pool = nullptr;
|
427
436
|
|
428
437
|
/* bdp estimator */
|
429
438
|
grpc_closure next_bdp_ping_timer_expired_locked;
|
@@ -432,23 +441,23 @@ struct grpc_chttp2_transport {
|
|
432
441
|
|
433
442
|
/* if non-NULL, close the transport with this error when writes are finished
|
434
443
|
*/
|
435
|
-
grpc_error* close_transport_on_writes_finished;
|
444
|
+
grpc_error* close_transport_on_writes_finished = GRPC_ERROR_NONE;
|
436
445
|
|
437
446
|
/* a list of closures to run after writes are finished */
|
438
|
-
grpc_closure_list run_after_write;
|
447
|
+
grpc_closure_list run_after_write = GRPC_CLOSURE_LIST_INIT;
|
439
448
|
|
440
449
|
/* buffer pool state */
|
441
450
|
/** have we scheduled a benign cleanup? */
|
442
|
-
bool benign_reclaimer_registered;
|
451
|
+
bool benign_reclaimer_registered = false;
|
443
452
|
/** have we scheduled a destructive cleanup? */
|
444
|
-
bool destructive_reclaimer_registered;
|
453
|
+
bool destructive_reclaimer_registered = false;
|
445
454
|
/** benign cleanup closure */
|
446
455
|
grpc_closure benign_reclaimer_locked;
|
447
456
|
/** destructive cleanup closure */
|
448
457
|
grpc_closure destructive_reclaimer_locked;
|
449
458
|
|
450
459
|
/* next bdp ping timer */
|
451
|
-
bool have_next_bdp_ping_timer;
|
460
|
+
bool have_next_bdp_ping_timer = false;
|
452
461
|
grpc_timer next_bdp_ping_timer;
|
453
462
|
|
454
463
|
/* keep-alive ping support */
|
@@ -469,12 +478,12 @@ struct grpc_chttp2_transport {
|
|
469
478
|
/** grace period for a ping to complete before watchdog kicks in */
|
470
479
|
grpc_millis keepalive_timeout;
|
471
480
|
/** if keepalive pings are allowed when there's no outstanding streams */
|
472
|
-
bool keepalive_permit_without_calls;
|
481
|
+
bool keepalive_permit_without_calls = false;
|
473
482
|
/** keep-alive state machine state */
|
474
483
|
grpc_chttp2_keepalive_state keepalive_state;
|
475
484
|
|
476
485
|
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> channelz_socket;
|
477
|
-
uint32_t num_messages_in_next_write;
|
486
|
+
uint32_t num_messages_in_next_write = 0;
|
478
487
|
};
|
479
488
|
|
480
489
|
typedef enum {
|
@@ -485,6 +494,10 @@ typedef enum {
|
|
485
494
|
} grpc_published_metadata_method;
|
486
495
|
|
487
496
|
struct grpc_chttp2_stream {
|
497
|
+
grpc_chttp2_stream(grpc_chttp2_transport* t, grpc_stream_refcount* refcount,
|
498
|
+
const void* server_data, gpr_arena* arena);
|
499
|
+
~grpc_chttp2_stream();
|
500
|
+
|
488
501
|
grpc_chttp2_transport* t;
|
489
502
|
grpc_stream_refcount* refcount;
|
490
503
|
|
@@ -492,63 +505,63 @@ struct grpc_chttp2_stream {
|
|
492
505
|
grpc_closure* destroy_stream_arg;
|
493
506
|
|
494
507
|
grpc_chttp2_stream_link links[STREAM_LIST_COUNT];
|
495
|
-
uint8_t included[STREAM_LIST_COUNT];
|
508
|
+
uint8_t included[STREAM_LIST_COUNT] = {};
|
496
509
|
|
497
510
|
/** HTTP2 stream id for this stream, or zero if one has not been assigned */
|
498
|
-
uint32_t id;
|
511
|
+
uint32_t id = 0;
|
499
512
|
|
500
513
|
/** things the upper layers would like to send */
|
501
|
-
grpc_metadata_batch* send_initial_metadata;
|
502
|
-
grpc_closure* send_initial_metadata_finished;
|
503
|
-
grpc_metadata_batch* send_trailing_metadata;
|
504
|
-
grpc_closure* send_trailing_metadata_finished;
|
514
|
+
grpc_metadata_batch* send_initial_metadata = nullptr;
|
515
|
+
grpc_closure* send_initial_metadata_finished = nullptr;
|
516
|
+
grpc_metadata_batch* send_trailing_metadata = nullptr;
|
517
|
+
grpc_closure* send_trailing_metadata_finished = nullptr;
|
505
518
|
|
506
519
|
grpc_core::OrphanablePtr<grpc_core::ByteStream> fetching_send_message;
|
507
|
-
uint32_t fetched_send_message_length;
|
508
|
-
grpc_slice fetching_slice;
|
520
|
+
uint32_t fetched_send_message_length = 0;
|
521
|
+
grpc_slice fetching_slice = grpc_empty_slice();
|
509
522
|
int64_t next_message_end_offset;
|
510
|
-
int64_t flow_controlled_bytes_written;
|
511
|
-
int64_t flow_controlled_bytes_flowed;
|
523
|
+
int64_t flow_controlled_bytes_written = 0;
|
524
|
+
int64_t flow_controlled_bytes_flowed = 0;
|
512
525
|
grpc_closure complete_fetch_locked;
|
513
|
-
grpc_closure* fetching_send_message_finished;
|
526
|
+
grpc_closure* fetching_send_message_finished = nullptr;
|
514
527
|
|
515
528
|
grpc_metadata_batch* recv_initial_metadata;
|
516
|
-
grpc_closure* recv_initial_metadata_ready;
|
517
|
-
bool* trailing_metadata_available;
|
529
|
+
grpc_closure* recv_initial_metadata_ready = nullptr;
|
530
|
+
bool* trailing_metadata_available = nullptr;
|
518
531
|
grpc_core::OrphanablePtr<grpc_core::ByteStream>* recv_message;
|
519
|
-
grpc_closure* recv_message_ready;
|
532
|
+
grpc_closure* recv_message_ready = nullptr;
|
520
533
|
grpc_metadata_batch* recv_trailing_metadata;
|
521
|
-
grpc_closure* recv_trailing_metadata_finished;
|
534
|
+
grpc_closure* recv_trailing_metadata_finished = nullptr;
|
522
535
|
|
523
|
-
grpc_transport_stream_stats* collecting_stats;
|
524
|
-
grpc_transport_stream_stats stats;
|
536
|
+
grpc_transport_stream_stats* collecting_stats = nullptr;
|
537
|
+
grpc_transport_stream_stats stats = grpc_transport_stream_stats();
|
525
538
|
|
526
539
|
/** Is this stream closed for writing. */
|
527
|
-
bool write_closed;
|
540
|
+
bool write_closed = false;
|
528
541
|
/** Is this stream reading half-closed. */
|
529
|
-
bool read_closed;
|
542
|
+
bool read_closed = false;
|
530
543
|
/** Are all published incoming byte streams closed. */
|
531
|
-
bool all_incoming_byte_streams_finished;
|
544
|
+
bool all_incoming_byte_streams_finished = false;
|
532
545
|
/** Has this stream seen an error.
|
533
546
|
If true, then pending incoming frames can be thrown away. */
|
534
|
-
bool seen_error;
|
547
|
+
bool seen_error = false;
|
535
548
|
/** Are we buffering writes on this stream? If yes, we won't become writable
|
536
549
|
until there's enough queued up in the flow_controlled_buffer */
|
537
|
-
bool write_buffering;
|
550
|
+
bool write_buffering = false;
|
538
551
|
/** Has trailing metadata been received. */
|
539
|
-
bool received_trailing_metadata;
|
552
|
+
bool received_trailing_metadata = false;
|
540
553
|
|
541
554
|
/* have we sent or received the EOS bit? */
|
542
|
-
bool eos_received;
|
543
|
-
bool eos_sent;
|
555
|
+
bool eos_received = false;
|
556
|
+
bool eos_sent = false;
|
544
557
|
|
545
558
|
/** the error that resulted in this stream being read-closed */
|
546
|
-
grpc_error* read_closed_error;
|
559
|
+
grpc_error* read_closed_error = GRPC_ERROR_NONE;
|
547
560
|
/** the error that resulted in this stream being write-closed */
|
548
|
-
grpc_error* write_closed_error;
|
561
|
+
grpc_error* write_closed_error = GRPC_ERROR_NONE;
|
549
562
|
|
550
|
-
grpc_published_metadata_method published_metadata[2];
|
551
|
-
bool final_metadata_requested;
|
563
|
+
grpc_published_metadata_method published_metadata[2] = {};
|
564
|
+
bool final_metadata_requested = false;
|
552
565
|
|
553
566
|
grpc_chttp2_incoming_metadata_buffer metadata_buffer[2];
|
554
567
|
|
@@ -558,33 +571,33 @@ struct grpc_chttp2_stream {
|
|
558
571
|
* Accessed only by application thread when stream->pending_byte_stream ==
|
559
572
|
* true */
|
560
573
|
grpc_slice_buffer unprocessed_incoming_frames_buffer;
|
561
|
-
grpc_closure* on_next;
|
562
|
-
bool pending_byte_stream; /* protected by t combiner */
|
574
|
+
grpc_closure* on_next = nullptr; /* protected by t combiner */
|
575
|
+
bool pending_byte_stream = false; /* protected by t combiner */
|
563
576
|
// cached length of buffer to be used by the transport thread in cases where
|
564
577
|
// stream->pending_byte_stream == true. The value is saved before
|
565
578
|
// application threads are allowed to modify
|
566
579
|
// unprocessed_incoming_frames_buffer
|
567
|
-
size_t unprocessed_incoming_frames_buffer_cached_length;
|
580
|
+
size_t unprocessed_incoming_frames_buffer_cached_length = 0;
|
568
581
|
grpc_closure reset_byte_stream;
|
569
|
-
grpc_error* byte_stream_error; /* protected by t combiner */
|
570
|
-
bool received_last_frame;
|
582
|
+
grpc_error* byte_stream_error = GRPC_ERROR_NONE; /* protected by t combiner */
|
583
|
+
bool received_last_frame = false; /* protected by t combiner */
|
571
584
|
|
572
|
-
grpc_millis deadline;
|
585
|
+
grpc_millis deadline = GRPC_MILLIS_INF_FUTURE;
|
573
586
|
|
574
587
|
/** saw some stream level error */
|
575
|
-
grpc_error* forced_close_error;
|
588
|
+
grpc_error* forced_close_error = GRPC_ERROR_NONE;
|
576
589
|
/** how many header frames have we received? */
|
577
|
-
uint8_t header_frames_received;
|
590
|
+
uint8_t header_frames_received = 0;
|
578
591
|
/** parsing state for data frames */
|
579
592
|
/* Accessed only by transport thread when stream->pending_byte_stream == false
|
580
593
|
* Accessed only by application thread when stream->pending_byte_stream ==
|
581
594
|
* true */
|
582
595
|
grpc_chttp2_data_parser data_parser;
|
583
596
|
/** number of bytes received - reset at end of parse thread execution */
|
584
|
-
int64_t received_bytes;
|
597
|
+
int64_t received_bytes = 0;
|
585
598
|
|
586
|
-
bool sent_initial_metadata;
|
587
|
-
bool sent_trailing_metadata;
|
599
|
+
bool sent_initial_metadata = false;
|
600
|
+
bool sent_trailing_metadata = false;
|
588
601
|
|
589
602
|
grpc_core::PolymorphicManualConstructor<
|
590
603
|
grpc_core::chttp2::StreamFlowControlBase,
|
@@ -594,32 +607,34 @@ struct grpc_chttp2_stream {
|
|
594
607
|
|
595
608
|
grpc_slice_buffer flow_controlled_buffer;
|
596
609
|
|
597
|
-
grpc_chttp2_write_cb* on_flow_controlled_cbs;
|
598
|
-
grpc_chttp2_write_cb* on_write_finished_cbs;
|
599
|
-
grpc_chttp2_write_cb* finish_after_write;
|
600
|
-
size_t sending_bytes;
|
610
|
+
grpc_chttp2_write_cb* on_flow_controlled_cbs = nullptr;
|
611
|
+
grpc_chttp2_write_cb* on_write_finished_cbs = nullptr;
|
612
|
+
grpc_chttp2_write_cb* finish_after_write = nullptr;
|
613
|
+
size_t sending_bytes = 0;
|
601
614
|
|
602
615
|
/* Stream compression method to be used. */
|
603
|
-
grpc_stream_compression_method stream_compression_method
|
616
|
+
grpc_stream_compression_method stream_compression_method =
|
617
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS;
|
604
618
|
/* Stream decompression method to be used. */
|
605
|
-
grpc_stream_compression_method stream_decompression_method
|
619
|
+
grpc_stream_compression_method stream_decompression_method =
|
620
|
+
GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS;
|
606
621
|
/** Stream compression decompress context */
|
607
|
-
grpc_stream_compression_context* stream_decompression_ctx;
|
622
|
+
grpc_stream_compression_context* stream_decompression_ctx = nullptr;
|
608
623
|
/** Stream compression compress context */
|
609
|
-
grpc_stream_compression_context* stream_compression_ctx;
|
624
|
+
grpc_stream_compression_context* stream_compression_ctx = nullptr;
|
610
625
|
|
611
626
|
/** Buffer storing data that is compressed but not sent */
|
612
627
|
grpc_slice_buffer compressed_data_buffer;
|
613
628
|
/** Amount of uncompressed bytes sent out when compressed_data_buffer is
|
614
629
|
* emptied */
|
615
|
-
size_t uncompressed_data_size;
|
630
|
+
size_t uncompressed_data_size = 0;
|
616
631
|
/** Temporary buffer storing decompressed data */
|
617
632
|
grpc_slice_buffer decompressed_data_buffer;
|
618
633
|
/** Whether bytes stored in unprocessed_incoming_byte_stream is decompressed
|
619
634
|
*/
|
620
|
-
bool unprocessed_incoming_frames_decompressed;
|
635
|
+
bool unprocessed_incoming_frames_decompressed = false;
|
621
636
|
/** gRPC header bytes that are already decompressed */
|
622
|
-
size_t decompressed_header_bytes;
|
637
|
+
size_t decompressed_header_bytes = 0;
|
623
638
|
};
|
624
639
|
|
625
640
|
/** Transport writing call flow:
|