grpc 1.3.4 → 1.4.0
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 +581 -450
- data/include/grpc/census.h +49 -49
- data/include/grpc/grpc.h +16 -70
- data/include/grpc/grpc_security.h +59 -59
- data/include/grpc/grpc_security_constants.h +9 -9
- data/include/grpc/impl/codegen/atm.h +1 -1
- data/include/grpc/impl/codegen/atm_windows.h +4 -4
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/compression_types.h +4 -5
- data/include/grpc/impl/codegen/gpr_slice.h +5 -5
- data/include/grpc/impl/codegen/gpr_types.h +6 -7
- data/include/grpc/impl/codegen/grpc_types.h +128 -59
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/propagation_bits.h +2 -2
- data/include/grpc/impl/codegen/slice.h +13 -12
- data/include/grpc/impl/codegen/status.h +23 -18
- data/include/grpc/impl/codegen/sync.h +1 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +47 -25
- data/include/grpc/slice_buffer.h +18 -14
- data/include/grpc/support/alloc.h +7 -7
- data/include/grpc/support/cmdline.h +10 -10
- data/include/grpc/support/cpu.h +3 -3
- data/include/grpc/support/histogram.h +1 -1
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +3 -3
- data/include/grpc/support/sync.h +31 -31
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +12 -12
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +2 -2
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/include/grpc/support/useful.h +2 -2
- data/include/grpc/support/workaround_list.h +46 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/intrusive_hash_map.c +319 -0
- data/src/core/ext/census/intrusive_hash_map.h +167 -0
- data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +173 -103
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +90 -59
- data/src/core/ext/filters/client_channel/parse_address.h +17 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +20 -17
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
- data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +30 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +9 -11
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/ev_windows.c +43 -0
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +45 -57
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/security/transport/security_handshaker.c +123 -97
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/cmdline.c +3 -3
- data/src/core/lib/support/histogram.c +2 -2
- data/src/core/lib/support/host_port.c +1 -1
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +36 -2
- data/src/core/lib/support/mpscq.h +28 -1
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/string.c +12 -12
- data/src/core/lib/support/string_posix.c +1 -1
- data/src/core/lib/support/subprocess_posix.c +2 -2
- data/src/core/lib/support/thd_posix.c +1 -1
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +694 -247
- data/src/core/lib/surface/completion_queue.h +30 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +79 -110
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +25 -9
- data/src/core/lib/transport/bdp_estimator.h +7 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/config_linux/ares_config.h +36 -2
- data/third_party/zlib/adler32.c +14 -7
- data/third_party/zlib/compress.c +24 -18
- data/third_party/zlib/crc32.c +29 -12
- data/third_party/zlib/deflate.c +499 -303
- data/third_party/zlib/deflate.h +19 -16
- data/third_party/zlib/gzguts.h +16 -7
- data/third_party/zlib/gzlib.c +17 -14
- data/third_party/zlib/gzread.c +108 -48
- data/third_party/zlib/gzwrite.c +210 -122
- data/third_party/zlib/infback.c +2 -2
- data/third_party/zlib/inffast.c +34 -51
- data/third_party/zlib/inflate.c +86 -37
- data/third_party/zlib/inflate.h +7 -4
- data/third_party/zlib/inftrees.c +12 -14
- data/third_party/zlib/trees.c +38 -61
- data/third_party/zlib/uncompr.c +66 -32
- data/third_party/zlib/zconf.h +32 -9
- data/third_party/zlib/zlib.h +298 -154
- data/third_party/zlib/zutil.c +25 -24
- data/third_party/zlib/zutil.h +35 -17
- metadata +63 -30
@@ -31,17 +31,20 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
#include
|
35
|
-
|
36
|
-
#include
|
34
|
+
#include <grpc/support/port_platform.h>
|
35
|
+
|
36
|
+
#include <limits.h>
|
37
|
+
#include <string.h>
|
37
38
|
|
38
39
|
#include <grpc/compression.h>
|
40
|
+
#include <grpc/grpc.h>
|
39
41
|
#include <grpc/support/alloc.h>
|
40
42
|
#include <grpc/support/log.h>
|
41
43
|
#include <grpc/support/string_util.h>
|
42
44
|
#include <grpc/support/useful.h>
|
43
45
|
|
44
|
-
#include
|
46
|
+
#include "src/core/lib/channel/channel_args.h"
|
47
|
+
#include "src/core/lib/support/string.h"
|
45
48
|
|
46
49
|
static grpc_arg copy_arg(const grpc_arg *src) {
|
47
50
|
grpc_arg dst;
|
@@ -329,7 +332,9 @@ const grpc_arg *grpc_channel_args_find(const grpc_channel_args *args,
|
|
329
332
|
return NULL;
|
330
333
|
}
|
331
334
|
|
332
|
-
int grpc_channel_arg_get_integer(grpc_arg *arg,
|
335
|
+
int grpc_channel_arg_get_integer(const grpc_arg *arg,
|
336
|
+
const grpc_integer_options options) {
|
337
|
+
if (arg == NULL) return options.default_value;
|
333
338
|
if (arg->type != GRPC_ARG_INTEGER) {
|
334
339
|
gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key);
|
335
340
|
return options.default_value;
|
@@ -347,9 +352,25 @@ int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options) {
|
|
347
352
|
return arg->value.integer;
|
348
353
|
}
|
349
354
|
|
355
|
+
bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value) {
|
356
|
+
if (arg == NULL) return default_value;
|
357
|
+
if (arg->type != GRPC_ARG_INTEGER) {
|
358
|
+
gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key);
|
359
|
+
return default_value;
|
360
|
+
}
|
361
|
+
switch (arg->value.integer) {
|
362
|
+
case 0:
|
363
|
+
return false;
|
364
|
+
case 1:
|
365
|
+
return true;
|
366
|
+
default:
|
367
|
+
gpr_log(GPR_ERROR, "%s treated as bool but set to %d (assuming true)",
|
368
|
+
arg->key, arg->value.integer);
|
369
|
+
return true;
|
370
|
+
}
|
371
|
+
}
|
372
|
+
|
350
373
|
bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args) {
|
351
|
-
|
352
|
-
|
353
|
-
if (arg->type == GRPC_ARG_INTEGER && arg->value.integer == 0) return false;
|
354
|
-
return true;
|
374
|
+
return grpc_channel_arg_get_bool(
|
375
|
+
grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK), false);
|
355
376
|
}
|
@@ -120,7 +120,11 @@ typedef struct grpc_integer_options {
|
|
120
120
|
int min_value;
|
121
121
|
int max_value;
|
122
122
|
} grpc_integer_options;
|
123
|
+
|
123
124
|
/** Returns the value of \a arg, subject to the contraints in \a options. */
|
124
|
-
int grpc_channel_arg_get_integer(grpc_arg *arg,
|
125
|
+
int grpc_channel_arg_get_integer(const grpc_arg *arg,
|
126
|
+
const grpc_integer_options options);
|
127
|
+
|
128
|
+
bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value);
|
125
129
|
|
126
130
|
#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */
|
@@ -307,10 +307,10 @@ void grpc_call_element_signal_error(grpc_exec_ctx *exec_ctx,
|
|
307
307
|
grpc_call_element *cur_elem,
|
308
308
|
grpc_error *error);
|
309
309
|
|
310
|
-
extern
|
310
|
+
extern grpc_tracer_flag grpc_trace_channel;
|
311
311
|
|
312
312
|
#define GRPC_CALL_LOG_OP(sev, elem, op) \
|
313
|
-
if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
|
313
|
+
if (GRPC_TRACER_ON(grpc_trace_channel)) grpc_call_log_op(sev, elem, op)
|
314
314
|
|
315
315
|
#ifdef __cplusplus
|
316
316
|
}
|
@@ -38,7 +38,8 @@
|
|
38
38
|
#include <grpc/support/alloc.h>
|
39
39
|
#include <grpc/support/string_util.h>
|
40
40
|
|
41
|
-
|
41
|
+
grpc_tracer_flag grpc_trace_channel_stack_builder =
|
42
|
+
GRPC_TRACER_INITIALIZER(false);
|
42
43
|
|
43
44
|
typedef struct filter_node {
|
44
45
|
struct filter_node *next;
|
@@ -113,6 +114,17 @@ grpc_channel_stack_builder_create_iterator_at_last(
|
|
113
114
|
return create_iterator_at_filter_node(builder, &builder->end);
|
114
115
|
}
|
115
116
|
|
117
|
+
bool grpc_channel_stack_builder_iterator_is_end(
|
118
|
+
grpc_channel_stack_builder_iterator *iterator) {
|
119
|
+
return iterator->node == &iterator->builder->end;
|
120
|
+
}
|
121
|
+
|
122
|
+
const char *grpc_channel_stack_builder_iterator_filter_name(
|
123
|
+
grpc_channel_stack_builder_iterator *iterator) {
|
124
|
+
if (iterator->node->filter == NULL) return NULL;
|
125
|
+
return iterator->node->filter->name;
|
126
|
+
}
|
127
|
+
|
116
128
|
bool grpc_channel_stack_builder_move_next(
|
117
129
|
grpc_channel_stack_builder_iterator *iterator) {
|
118
130
|
if (iterator->node == &iterator->builder->end) return false;
|
@@ -98,6 +98,10 @@ bool grpc_channel_stack_builder_iterator_is_first(
|
|
98
98
|
bool grpc_channel_stack_builder_iterator_is_end(
|
99
99
|
grpc_channel_stack_builder_iterator *iterator);
|
100
100
|
|
101
|
+
/// What is the name of the filter at this iterator position?
|
102
|
+
const char *grpc_channel_stack_builder_iterator_filter_name(
|
103
|
+
grpc_channel_stack_builder_iterator *iterator);
|
104
|
+
|
101
105
|
/// Move an iterator to the next item
|
102
106
|
bool grpc_channel_stack_builder_move_next(
|
103
107
|
grpc_channel_stack_builder_iterator *iterator);
|
@@ -161,7 +165,7 @@ grpc_error *grpc_channel_stack_builder_finish(
|
|
161
165
|
void grpc_channel_stack_builder_destroy(grpc_exec_ctx *exec_ctx,
|
162
166
|
grpc_channel_stack_builder *builder);
|
163
167
|
|
164
|
-
extern
|
168
|
+
extern grpc_tracer_flag grpc_trace_channel_stack_builder;
|
165
169
|
|
166
170
|
#ifdef __cplusplus
|
167
171
|
}
|
@@ -128,7 +128,9 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
|
|
128
128
|
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
129
129
|
grpc_channel_element *elem) {
|
130
130
|
channel_data *cd = (channel_data *)elem->channel_data;
|
131
|
-
|
131
|
+
if (cd->transport) {
|
132
|
+
grpc_transport_destroy(exec_ctx, cd->transport);
|
133
|
+
}
|
132
134
|
}
|
133
135
|
|
134
136
|
static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
|
@@ -50,8 +50,8 @@ typedef enum {
|
|
50
50
|
/// Reserved for traffic_class_context.
|
51
51
|
GRPC_CONTEXT_TRAFFIC,
|
52
52
|
|
53
|
-
///
|
54
|
-
|
53
|
+
/// Value is a \a grpc_grpclb_client_stats.
|
54
|
+
GRPC_GRPCLB_CLIENT_STATS,
|
55
55
|
|
56
56
|
GRPC_CONTEXT_COUNT
|
57
57
|
} grpc_context_index;
|
@@ -50,7 +50,7 @@ static int zlib_body(grpc_exec_ctx* exec_ctx, z_stream* zs,
|
|
50
50
|
int r;
|
51
51
|
int flush;
|
52
52
|
size_t i;
|
53
|
-
grpc_slice outbuf =
|
53
|
+
grpc_slice outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
|
54
54
|
const uInt uint_max = ~(uInt)0;
|
55
55
|
|
56
56
|
GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
|
@@ -65,7 +65,7 @@ static int zlib_body(grpc_exec_ctx* exec_ctx, z_stream* zs,
|
|
65
65
|
do {
|
66
66
|
if (zs->avail_out == 0) {
|
67
67
|
grpc_slice_buffer_add_indexed(output, outbuf);
|
68
|
-
outbuf =
|
68
|
+
outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
|
69
69
|
GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
|
70
70
|
zs->avail_out = (uInt)GRPC_SLICE_LENGTH(outbuf);
|
71
71
|
zs->next_out = GRPC_SLICE_START_PTR(outbuf);
|
data/src/core/lib/debug/trace.c
CHANGED
@@ -35,24 +35,31 @@
|
|
35
35
|
|
36
36
|
#include <string.h>
|
37
37
|
|
38
|
-
#include <grpc/grpc.h>
|
39
38
|
#include <grpc/support/alloc.h>
|
40
39
|
#include <grpc/support/log.h>
|
41
40
|
#include "src/core/lib/support/env.h"
|
42
41
|
|
42
|
+
int grpc_tracer_set_enabled(const char *name, int enabled);
|
43
|
+
|
43
44
|
typedef struct tracer {
|
44
45
|
const char *name;
|
45
|
-
|
46
|
+
grpc_tracer_flag *flag;
|
46
47
|
struct tracer *next;
|
47
48
|
} tracer;
|
48
49
|
static tracer *tracers;
|
49
50
|
|
50
|
-
|
51
|
+
#ifdef GRPC_THREADSAFE_TRACER
|
52
|
+
#define TRACER_SET(flag, on) gpr_atm_no_barrier_store(&(flag).value, (on))
|
53
|
+
#else
|
54
|
+
#define TRACER_SET(flag, on) (flag).value = (on)
|
55
|
+
#endif
|
56
|
+
|
57
|
+
void grpc_register_tracer(const char *name, grpc_tracer_flag *flag) {
|
51
58
|
tracer *t = gpr_malloc(sizeof(*t));
|
52
59
|
t->name = name;
|
53
60
|
t->flag = flag;
|
54
61
|
t->next = tracers;
|
55
|
-
*flag
|
62
|
+
TRACER_SET(*flag, false);
|
56
63
|
tracers = t;
|
57
64
|
}
|
58
65
|
|
@@ -121,13 +128,13 @@ int grpc_tracer_set_enabled(const char *name, int enabled) {
|
|
121
128
|
tracer *t;
|
122
129
|
if (0 == strcmp(name, "all")) {
|
123
130
|
for (t = tracers; t; t = t->next) {
|
124
|
-
*t->flag
|
131
|
+
TRACER_SET(*t->flag, enabled);
|
125
132
|
}
|
126
133
|
} else {
|
127
134
|
int found = 0;
|
128
135
|
for (t = tracers; t; t = t->next) {
|
129
136
|
if (0 == strcmp(name, t->name)) {
|
130
|
-
*t->flag
|
137
|
+
TRACER_SET(*t->flag, enabled);
|
131
138
|
found = 1;
|
132
139
|
}
|
133
140
|
}
|
data/src/core/lib/debug/trace.h
CHANGED
@@ -34,9 +34,35 @@
|
|
34
34
|
#ifndef GRPC_CORE_LIB_DEBUG_TRACE_H
|
35
35
|
#define GRPC_CORE_LIB_DEBUG_TRACE_H
|
36
36
|
|
37
|
+
#include <grpc/support/atm.h>
|
37
38
|
#include <grpc/support/port_platform.h>
|
39
|
+
#include <stdbool.h>
|
38
40
|
|
39
|
-
|
41
|
+
#if defined(__has_feature)
|
42
|
+
#if __has_feature(thread_sanitizer)
|
43
|
+
#define GRPC_THREADSAFE_TRACER
|
44
|
+
#endif
|
45
|
+
#endif
|
46
|
+
|
47
|
+
typedef struct {
|
48
|
+
#ifdef GRPC_THREADSAFE_TRACER
|
49
|
+
gpr_atm value;
|
50
|
+
#else
|
51
|
+
bool value;
|
52
|
+
#endif
|
53
|
+
} grpc_tracer_flag;
|
54
|
+
|
55
|
+
#ifdef GRPC_THREADSAFE_TRACER
|
56
|
+
#define GRPC_TRACER_ON(flag) (gpr_atm_no_barrier_load(&(flag).value) != 0)
|
57
|
+
#define GRPC_TRACER_INITIALIZER(on) \
|
58
|
+
{ (gpr_atm)(on) }
|
59
|
+
#else
|
60
|
+
#define GRPC_TRACER_ON(flag) ((flag).value)
|
61
|
+
#define GRPC_TRACER_INITIALIZER(on) \
|
62
|
+
{ (on) }
|
63
|
+
#endif
|
64
|
+
|
65
|
+
void grpc_register_tracer(const char *name, grpc_tracer_flag *flag);
|
40
66
|
void grpc_tracer_init(const char *env_var_name);
|
41
67
|
void grpc_tracer_shutdown(void);
|
42
68
|
|
data/src/core/lib/http/httpcli.c
CHANGED
@@ -244,7 +244,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req,
|
|
244
244
|
static void on_resolved(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
245
245
|
internal_request *req = arg;
|
246
246
|
if (error != GRPC_ERROR_NONE) {
|
247
|
-
finish(exec_ctx, req, error);
|
247
|
+
finish(exec_ctx, req, GRPC_ERROR_REF(error));
|
248
248
|
return;
|
249
249
|
}
|
250
250
|
req->next_address = 0;
|
@@ -44,6 +44,7 @@
|
|
44
44
|
#include "src/core/lib/slice/slice_internal.h"
|
45
45
|
#include "src/core/lib/support/string.h"
|
46
46
|
#include "src/core/tsi/ssl_transport_security.h"
|
47
|
+
#include "src/core/tsi/transport_security_adapter.h"
|
47
48
|
|
48
49
|
typedef struct {
|
49
50
|
grpc_channel_security_connector base;
|
@@ -78,7 +79,8 @@ static void httpcli_ssl_add_handshakers(grpc_exec_ctx *exec_ctx,
|
|
78
79
|
}
|
79
80
|
grpc_handshake_manager_add(
|
80
81
|
handshake_mgr,
|
81
|
-
grpc_security_handshaker_create(
|
82
|
+
grpc_security_handshaker_create(
|
83
|
+
exec_ctx, tsi_create_adapter_handshaker(handshaker), &sc->base));
|
82
84
|
}
|
83
85
|
|
84
86
|
static void httpcli_ssl_check_peer(grpc_exec_ctx *exec_ctx,
|
@@ -106,9 +108,8 @@ static grpc_security_connector_vtable httpcli_ssl_vtable = {
|
|
106
108
|
httpcli_ssl_destroy, httpcli_ssl_check_peer};
|
107
109
|
|
108
110
|
static grpc_security_status httpcli_ssl_channel_security_connector_create(
|
109
|
-
grpc_exec_ctx *exec_ctx, const
|
110
|
-
|
111
|
-
grpc_channel_security_connector **sc) {
|
111
|
+
grpc_exec_ctx *exec_ctx, const char *pem_root_certs,
|
112
|
+
const char *secure_peer_name, grpc_channel_security_connector **sc) {
|
112
113
|
tsi_result result = TSI_OK;
|
113
114
|
grpc_httpcli_ssl_channel_security_connector *c;
|
114
115
|
|
@@ -126,8 +127,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
|
|
126
127
|
c->secure_peer_name = gpr_strdup(secure_peer_name);
|
127
128
|
}
|
128
129
|
result = tsi_create_ssl_client_handshaker_factory(
|
129
|
-
NULL,
|
130
|
-
0, &c->handshaker_factory);
|
130
|
+
NULL, pem_root_certs, NULL, NULL, 0, &c->handshaker_factory);
|
131
131
|
if (result != TSI_OK) {
|
132
132
|
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
|
133
133
|
tsi_result_to_string(result));
|
@@ -173,10 +173,9 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
|
|
173
173
|
void (*on_done)(grpc_exec_ctx *exec_ctx, void *arg,
|
174
174
|
grpc_endpoint *endpoint)) {
|
175
175
|
grpc_channel_security_connector *sc = NULL;
|
176
|
-
const unsigned char *pem_root_certs = NULL;
|
177
176
|
on_done_closure *c = gpr_malloc(sizeof(*c));
|
178
|
-
|
179
|
-
if (pem_root_certs == NULL
|
177
|
+
const char *pem_root_certs = grpc_get_default_ssl_roots();
|
178
|
+
if (pem_root_certs == NULL) {
|
180
179
|
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
|
181
180
|
on_done(exec_ctx, arg, NULL);
|
182
181
|
gpr_free(c);
|
@@ -186,8 +185,7 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
|
|
186
185
|
c->arg = arg;
|
187
186
|
c->handshake_mgr = grpc_handshake_manager_create();
|
188
187
|
GPR_ASSERT(httpcli_ssl_channel_security_connector_create(
|
189
|
-
exec_ctx, pem_root_certs,
|
190
|
-
GRPC_SECURITY_OK);
|
188
|
+
exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK);
|
191
189
|
grpc_channel_security_connector_add_handshakers(exec_ctx, sc,
|
192
190
|
c->handshake_mgr);
|
193
191
|
grpc_handshake_manager_do_handshake(
|
data/src/core/lib/http/parser.c
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
#include <grpc/support/log.h>
|
41
41
|
#include <grpc/support/useful.h>
|
42
42
|
|
43
|
-
|
43
|
+
grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false);
|
44
44
|
|
45
45
|
static char *buf2str(void *buffer, size_t length) {
|
46
46
|
char *out = gpr_malloc(length + 1);
|
@@ -308,7 +308,7 @@ static grpc_error *addbyte(grpc_http_parser *parser, uint8_t byte,
|
|
308
308
|
case GRPC_HTTP_FIRST_LINE:
|
309
309
|
case GRPC_HTTP_HEADERS:
|
310
310
|
if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
|
311
|
-
if (grpc_http1_trace)
|
311
|
+
if (GRPC_TRACER_ON(grpc_http1_trace))
|
312
312
|
gpr_log(GPR_ERROR, "HTTP header max line length (%d) exceeded",
|
313
313
|
GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
|
314
314
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
data/src/core/lib/http/parser.h
CHANGED
@@ -36,6 +36,7 @@
|
|
36
36
|
|
37
37
|
#include <grpc/slice.h>
|
38
38
|
#include <grpc/support/port_platform.h>
|
39
|
+
#include "src/core/lib/debug/trace.h"
|
39
40
|
#include "src/core/lib/iomgr/error.h"
|
40
41
|
|
41
42
|
/* Maximum length of a header string of the form 'Key: Value\r\n' */
|
@@ -121,6 +122,6 @@ grpc_error *grpc_http_parser_eof(grpc_http_parser *parser);
|
|
121
122
|
void grpc_http_request_destroy(grpc_http_request *request);
|
122
123
|
void grpc_http_response_destroy(grpc_http_response *response);
|
123
124
|
|
124
|
-
extern
|
125
|
+
extern grpc_tracer_flag grpc_http1_trace;
|
125
126
|
|
126
127
|
#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */
|
@@ -42,13 +42,13 @@
|
|
42
42
|
#include "src/core/lib/iomgr/workqueue.h"
|
43
43
|
#include "src/core/lib/profiling/timers.h"
|
44
44
|
|
45
|
-
|
45
|
+
grpc_tracer_flag grpc_combiner_trace = GRPC_TRACER_INITIALIZER(false);
|
46
46
|
|
47
|
-
#define GRPC_COMBINER_TRACE(fn)
|
48
|
-
do {
|
49
|
-
if (grpc_combiner_trace) {
|
50
|
-
fn;
|
51
|
-
}
|
47
|
+
#define GRPC_COMBINER_TRACE(fn) \
|
48
|
+
do { \
|
49
|
+
if (GRPC_TRACER_ON(grpc_combiner_trace)) { \
|
50
|
+
fn; \
|
51
|
+
} \
|
52
52
|
} while (0)
|
53
53
|
|
54
54
|
#define STATE_UNORPHANED 1
|
@@ -37,6 +37,7 @@
|
|
37
37
|
#include <stddef.h>
|
38
38
|
|
39
39
|
#include <grpc/support/atm.h>
|
40
|
+
#include "src/core/lib/debug/trace.h"
|
40
41
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
41
42
|
#include "src/core/lib/support/mpscq.h"
|
42
43
|
|
@@ -78,6 +79,6 @@ grpc_closure_scheduler *grpc_combiner_finally_scheduler(grpc_combiner *lock,
|
|
78
79
|
|
79
80
|
bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx);
|
80
81
|
|
81
|
-
extern
|
82
|
+
extern grpc_tracer_flag grpc_combiner_trace;
|
82
83
|
|
83
84
|
#endif /* GRPC_CORE_LIB_IOMGR_COMBINER_H */
|
data/src/core/lib/iomgr/error.c
CHANGED
@@ -217,8 +217,14 @@ static uint8_t get_placement(grpc_error **err, size_t size) {
|
|
217
217
|
if ((*err)->arena_size + slots > (*err)->arena_capacity) {
|
218
218
|
return UINT8_MAX;
|
219
219
|
}
|
220
|
+
#ifdef GRPC_ERROR_REFCOUNT_DEBUG
|
221
|
+
grpc_error *orig = *err;
|
222
|
+
#endif
|
220
223
|
*err = gpr_realloc(
|
221
224
|
*err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t));
|
225
|
+
#ifdef GRPC_ERROR_REFCOUNT_DEBUG
|
226
|
+
if (*err != orig) gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err);
|
227
|
+
#endif
|
222
228
|
}
|
223
229
|
uint8_t placement = (*err)->arena_size;
|
224
230
|
(*err)->arena_size = (uint8_t)((*err)->arena_size + slots);
|
@@ -313,7 +319,7 @@ static void internal_add_error(grpc_error **err, grpc_error *new) {
|
|
313
319
|
// It is very common to include and extra int and string in an error
|
314
320
|
#define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME)
|
315
321
|
|
316
|
-
grpc_error *grpc_error_create(
|
322
|
+
grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc,
|
317
323
|
grpc_error **referencing,
|
318
324
|
size_t num_referencing) {
|
319
325
|
GPR_TIMER_BEGIN("grpc_error_create", 0);
|
@@ -339,7 +345,8 @@ grpc_error *grpc_error_create(grpc_slice file, int line, grpc_slice desc,
|
|
339
345
|
memset(err->times, UINT8_MAX, GRPC_ERROR_TIME_MAX);
|
340
346
|
|
341
347
|
internal_set_int(&err, GRPC_ERROR_INT_FILE_LINE, line);
|
342
|
-
internal_set_str(&err, GRPC_ERROR_STR_FILE,
|
348
|
+
internal_set_str(&err, GRPC_ERROR_STR_FILE,
|
349
|
+
grpc_slice_from_static_string(file));
|
343
350
|
internal_set_str(&err, GRPC_ERROR_STR_DESCRIPTION, desc);
|
344
351
|
|
345
352
|
for (size_t i = 0; i < num_referencing; ++i) {
|
@@ -756,13 +763,13 @@ grpc_error *grpc_os_error(const char *file, int line, int err,
|
|
756
763
|
return grpc_error_set_str(
|
757
764
|
grpc_error_set_str(
|
758
765
|
grpc_error_set_int(
|
759
|
-
grpc_error_create(
|
766
|
+
grpc_error_create(file, line,
|
760
767
|
grpc_slice_from_static_string("OS Error"), NULL,
|
761
768
|
0),
|
762
769
|
GRPC_ERROR_INT_ERRNO, err),
|
763
770
|
GRPC_ERROR_STR_OS_ERROR,
|
764
771
|
grpc_slice_from_static_string(strerror(err))),
|
765
|
-
GRPC_ERROR_STR_SYSCALL,
|
772
|
+
GRPC_ERROR_STR_SYSCALL, grpc_slice_from_copied_string(call_name));
|
766
773
|
}
|
767
774
|
|
768
775
|
#ifdef GPR_WINDOWS
|
@@ -772,7 +779,7 @@ grpc_error *grpc_wsa_error(const char *file, int line, int err,
|
|
772
779
|
grpc_error *error = grpc_error_set_str(
|
773
780
|
grpc_error_set_str(
|
774
781
|
grpc_error_set_int(
|
775
|
-
grpc_error_create(
|
782
|
+
grpc_error_create(file, line,
|
776
783
|
grpc_slice_from_static_string("OS Error"), NULL,
|
777
784
|
0),
|
778
785
|
GRPC_ERROR_INT_WSA_ERROR, err),
|