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
@@ -51,6 +51,12 @@ extern void (*grpc_resolve_address_ares)(grpc_exec_ctx *exec_ctx,
|
|
51
51
|
grpc_closure *on_done,
|
52
52
|
grpc_resolved_addresses **addresses);
|
53
53
|
|
54
|
+
void grpc_dns_lookup_ares(grpc_exec_ctx *exec_ctx, const char *dns_server,
|
55
|
+
const char *addr, const char *default_port,
|
56
|
+
grpc_pollset_set *interested_parties,
|
57
|
+
grpc_closure *on_done,
|
58
|
+
grpc_resolved_addresses **addresses);
|
59
|
+
|
54
60
|
/* Initialize gRPC ares wrapper. Must be called at least once before
|
55
61
|
grpc_resolve_address_ares(). */
|
56
62
|
grpc_error *grpc_ares_init(void);
|
@@ -157,8 +157,8 @@ static void do_nothing(void *ignored) {}
|
|
157
157
|
|
158
158
|
static grpc_resolver *sockaddr_create(grpc_exec_ctx *exec_ctx,
|
159
159
|
grpc_resolver_args *args,
|
160
|
-
|
161
|
-
|
160
|
+
bool parse(const grpc_uri *uri,
|
161
|
+
grpc_resolved_address *dst)) {
|
162
162
|
if (0 != strcmp(args->uri->authority, "")) {
|
163
163
|
gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme",
|
164
164
|
args->uri->scheme);
|
@@ -209,7 +209,7 @@ static void sockaddr_factory_unref(grpc_resolver_factory *factory) {}
|
|
209
209
|
static grpc_resolver *name##_factory_create_resolver( \
|
210
210
|
grpc_exec_ctx *exec_ctx, grpc_resolver_factory *factory, \
|
211
211
|
grpc_resolver_args *args) { \
|
212
|
-
return sockaddr_create(exec_ctx, args,
|
212
|
+
return sockaddr_create(exec_ctx, args, grpc_parse_##name); \
|
213
213
|
} \
|
214
214
|
static const grpc_resolver_factory_vtable name##_factory_vtable = { \
|
215
215
|
sockaddr_factory_ref, sockaddr_factory_unref, \
|
@@ -59,9 +59,9 @@
|
|
59
59
|
#define INTERNAL_REF_BITS 16
|
60
60
|
#define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1))
|
61
61
|
|
62
|
-
#define GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS 20
|
63
62
|
#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1
|
64
63
|
#define GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER 1.6
|
64
|
+
#define GRPC_SUBCHANNEL_RECONNECT_MIN_BACKOFF_SECONDS 20
|
65
65
|
#define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120
|
66
66
|
#define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2
|
67
67
|
|
@@ -283,6 +283,7 @@ static void disconnect(grpc_exec_ctx *exec_ctx, grpc_subchannel *c) {
|
|
283
283
|
void grpc_subchannel_unref(grpc_exec_ctx *exec_ctx,
|
284
284
|
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
|
285
285
|
gpr_atm old_refs;
|
286
|
+
// add a weak ref and subtract a strong ref (atomically)
|
286
287
|
old_refs = ref_mutate(c, (gpr_atm)1 - (gpr_atm)(1 << INTERNAL_REF_BITS),
|
287
288
|
1 REF_MUTATE_PURPOSE("STRONG_UNREF"));
|
288
289
|
if ((old_refs & STRONG_REF_MASK) == (1 << INTERNAL_REF_BITS)) {
|
@@ -353,8 +354,8 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
|
|
353
354
|
"subchannel");
|
354
355
|
int initial_backoff_ms =
|
355
356
|
GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS * 1000;
|
357
|
+
int min_backoff_ms = GRPC_SUBCHANNEL_RECONNECT_MIN_BACKOFF_SECONDS * 1000;
|
356
358
|
int max_backoff_ms = GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS * 1000;
|
357
|
-
int min_backoff_ms = GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS * 1000;
|
358
359
|
bool fixed_reconnect_backoff = false;
|
359
360
|
if (c->args) {
|
360
361
|
for (size_t i = 0; i < c->args->num_args; i++) {
|
@@ -365,6 +366,12 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
|
|
365
366
|
grpc_channel_arg_get_integer(
|
366
367
|
&c->args->args[i],
|
367
368
|
(grpc_integer_options){initial_backoff_ms, 100, INT_MAX});
|
369
|
+
} else if (0 == strcmp(c->args->args[i].key,
|
370
|
+
GRPC_ARG_MIN_RECONNECT_BACKOFF_MS)) {
|
371
|
+
fixed_reconnect_backoff = false;
|
372
|
+
min_backoff_ms = grpc_channel_arg_get_integer(
|
373
|
+
&c->args->args[i],
|
374
|
+
(grpc_integer_options){min_backoff_ms, 100, INT_MAX});
|
368
375
|
} else if (0 == strcmp(c->args->args[i].key,
|
369
376
|
GRPC_ARG_MAX_RECONNECT_BACKOFF_MS)) {
|
370
377
|
fixed_reconnect_backoff = false;
|
@@ -609,7 +616,7 @@ void grpc_connected_subchannel_ping(grpc_exec_ctx *exec_ctx,
|
|
609
616
|
elem->filter->start_transport_op(exec_ctx, elem, op);
|
610
617
|
}
|
611
618
|
|
612
|
-
static
|
619
|
+
static bool publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
613
620
|
grpc_subchannel *c) {
|
614
621
|
grpc_connected_subchannel *con;
|
615
622
|
grpc_channel_stack *stk;
|
@@ -625,15 +632,16 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
625
632
|
if (!grpc_channel_init_create_stack(exec_ctx, builder,
|
626
633
|
GRPC_CLIENT_SUBCHANNEL)) {
|
627
634
|
grpc_channel_stack_builder_destroy(exec_ctx, builder);
|
628
|
-
|
635
|
+
return false;
|
629
636
|
}
|
630
637
|
grpc_error *error = grpc_channel_stack_builder_finish(
|
631
638
|
exec_ctx, builder, 0, 1, connection_destroy, NULL, (void **)&con);
|
632
639
|
if (error != GRPC_ERROR_NONE) {
|
640
|
+
grpc_transport_destroy(exec_ctx, c->connecting_result.transport);
|
633
641
|
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
|
634
642
|
grpc_error_string(error));
|
635
643
|
GRPC_ERROR_UNREF(error);
|
636
|
-
|
644
|
+
return false;
|
637
645
|
}
|
638
646
|
stk = CHANNEL_STACK_FROM_CONNECTION(con);
|
639
647
|
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
|
@@ -649,8 +657,7 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
649
657
|
gpr_free(sw_subchannel);
|
650
658
|
grpc_channel_stack_destroy(exec_ctx, stk);
|
651
659
|
gpr_free(con);
|
652
|
-
|
653
|
-
return;
|
660
|
+
return false;
|
654
661
|
}
|
655
662
|
|
656
663
|
/* publish */
|
@@ -672,6 +679,7 @@ static void publish_transport_locked(grpc_exec_ctx *exec_ctx,
|
|
672
679
|
/* signal completion */
|
673
680
|
grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY,
|
674
681
|
GRPC_ERROR_NONE, "connected");
|
682
|
+
return true;
|
675
683
|
}
|
676
684
|
|
677
685
|
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
@@ -682,8 +690,9 @@ static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *arg,
|
|
682
690
|
GRPC_SUBCHANNEL_WEAK_REF(c, "connected");
|
683
691
|
gpr_mu_lock(&c->mu);
|
684
692
|
c->connecting = false;
|
685
|
-
if (c->connecting_result.transport != NULL
|
686
|
-
|
693
|
+
if (c->connecting_result.transport != NULL &&
|
694
|
+
publish_transport_locked(exec_ctx, c)) {
|
695
|
+
/* do nothing, transport was published */
|
687
696
|
} else if (c->disconnected) {
|
688
697
|
GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
|
689
698
|
} else {
|
@@ -772,7 +781,7 @@ grpc_error *grpc_connected_subchannel_create_call(
|
|
772
781
|
(*call)->connection = GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
|
773
782
|
const grpc_call_element_args call_args = {.call_stack = callstk,
|
774
783
|
.server_transport_data = NULL,
|
775
|
-
.context =
|
784
|
+
.context = args->context,
|
776
785
|
.path = args->path,
|
777
786
|
.start_time = args->start_time,
|
778
787
|
.deadline = args->deadline,
|
@@ -797,13 +806,7 @@ static void grpc_uri_to_sockaddr(grpc_exec_ctx *exec_ctx, const char *uri_str,
|
|
797
806
|
grpc_resolved_address *addr) {
|
798
807
|
grpc_uri *uri = grpc_uri_parse(exec_ctx, uri_str, 0 /* suppress_errors */);
|
799
808
|
GPR_ASSERT(uri != NULL);
|
800
|
-
if (
|
801
|
-
GPR_ASSERT(parse_ipv4(uri, addr));
|
802
|
-
} else if (strcmp(uri->scheme, "ipv6") == 0) {
|
803
|
-
GPR_ASSERT(parse_ipv6(uri, addr));
|
804
|
-
} else {
|
805
|
-
GPR_ASSERT(parse_unix(uri, addr));
|
806
|
-
}
|
809
|
+
if (!grpc_parse_uri(uri, addr)) memset(addr, 0, sizeof(*addr));
|
807
810
|
grpc_uri_destroy(uri);
|
808
811
|
}
|
809
812
|
|
@@ -183,8 +183,11 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
|
|
183
183
|
enter_ctx(exec_ctx);
|
184
184
|
|
185
185
|
grpc_subchannel *c = NULL;
|
186
|
+
bool need_to_unref_constructed;
|
186
187
|
|
187
188
|
while (c == NULL) {
|
189
|
+
need_to_unref_constructed = false;
|
190
|
+
|
188
191
|
// Compare and swap loop:
|
189
192
|
// - take a reference to the current index
|
190
193
|
gpr_mu_lock(&g_mu);
|
@@ -193,9 +196,12 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
|
|
193
196
|
|
194
197
|
// - Check to see if a subchannel already exists
|
195
198
|
c = gpr_avl_get(index, key);
|
199
|
+
if (c != NULL) {
|
200
|
+
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
|
201
|
+
}
|
196
202
|
if (c != NULL) {
|
197
203
|
// yes -> we're done
|
198
|
-
|
204
|
+
need_to_unref_constructed = true;
|
199
205
|
} else {
|
200
206
|
// no -> update the avl and compare/swap
|
201
207
|
gpr_avl updated =
|
@@ -219,6 +225,10 @@ grpc_subchannel *grpc_subchannel_index_register(grpc_exec_ctx *exec_ctx,
|
|
219
225
|
|
220
226
|
leave_ctx(exec_ctx);
|
221
227
|
|
228
|
+
if (need_to_unref_constructed) {
|
229
|
+
GRPC_SUBCHANNEL_UNREF(exec_ctx, constructed, "index_register");
|
230
|
+
}
|
231
|
+
|
222
232
|
return c;
|
223
233
|
}
|
224
234
|
|
@@ -50,7 +50,7 @@
|
|
50
50
|
#define NOT_SET (~(size_t)0)
|
51
51
|
|
52
52
|
static grpc_uri *bad_uri(const char *uri_text, size_t pos, const char *section,
|
53
|
-
|
53
|
+
bool suppress_errors) {
|
54
54
|
char *line_prefix;
|
55
55
|
size_t pfx_len;
|
56
56
|
|
@@ -83,6 +83,11 @@ static char *decode_and_copy_component(grpc_exec_ctx *exec_ctx, const char *src,
|
|
83
83
|
return out;
|
84
84
|
}
|
85
85
|
|
86
|
+
static bool valid_hex(char c) {
|
87
|
+
return ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F')) ||
|
88
|
+
((c >= '0') && (c <= '9'));
|
89
|
+
}
|
90
|
+
|
86
91
|
/** Returns how many chars to advance if \a uri_text[i] begins a valid \a pchar
|
87
92
|
* production. If \a uri_text[i] introduces an invalid \a pchar (such as percent
|
88
93
|
* sign not followed by two hex digits), NOT_SET is returned. */
|
@@ -93,27 +98,36 @@ static size_t parse_pchar(const char *uri_text, size_t i) {
|
|
93
98
|
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
94
99
|
/ "*" / "+" / "," / ";" / "=" */
|
95
100
|
char c = uri_text[i];
|
96
|
-
|
97
|
-
|
98
|
-
(c
|
99
|
-
|
100
|
-
|
101
|
-
c == '=') /* sub-delims */) {
|
102
|
-
return 1;
|
103
|
-
}
|
104
|
-
if (c == '%') { /* pct-encoded */
|
105
|
-
size_t j;
|
106
|
-
if (uri_text[i + 1] == 0 || uri_text[i + 2] == 0) {
|
107
|
-
return NOT_SET;
|
108
|
-
}
|
109
|
-
for (j = i + 1; j < 2; j++) {
|
110
|
-
c = uri_text[j];
|
111
|
-
if (!(((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) ||
|
112
|
-
((c >= 'A') && (c <= 'F')))) {
|
113
|
-
return NOT_SET;
|
101
|
+
switch (c) {
|
102
|
+
default:
|
103
|
+
if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
|
104
|
+
((c >= '0') && (c <= '9'))) {
|
105
|
+
return 1;
|
114
106
|
}
|
115
|
-
|
116
|
-
|
107
|
+
break;
|
108
|
+
case ':':
|
109
|
+
case '@':
|
110
|
+
case '-':
|
111
|
+
case '.':
|
112
|
+
case '_':
|
113
|
+
case '~':
|
114
|
+
case '!':
|
115
|
+
case '$':
|
116
|
+
case '&':
|
117
|
+
case '\'':
|
118
|
+
case '(':
|
119
|
+
case ')':
|
120
|
+
case '*':
|
121
|
+
case '+':
|
122
|
+
case ',':
|
123
|
+
case ';':
|
124
|
+
case '=':
|
125
|
+
return 1;
|
126
|
+
case '%': /* pct-encoded */
|
127
|
+
if (valid_hex(uri_text[i + 1]) && valid_hex(uri_text[i + 2])) {
|
128
|
+
return 2;
|
129
|
+
}
|
130
|
+
return NOT_SET;
|
117
131
|
}
|
118
132
|
return 0;
|
119
133
|
}
|
@@ -183,7 +197,7 @@ static void parse_query_parts(grpc_uri *uri) {
|
|
183
197
|
}
|
184
198
|
|
185
199
|
grpc_uri *grpc_uri_parse(grpc_exec_ctx *exec_ctx, const char *uri_text,
|
186
|
-
|
200
|
+
bool suppress_errors) {
|
187
201
|
grpc_uri *uri;
|
188
202
|
size_t scheme_begin = 0;
|
189
203
|
size_t scheme_end = NOT_SET;
|
@@ -53,7 +53,7 @@ typedef struct {
|
|
53
53
|
|
54
54
|
/** parse a uri, return NULL on failure */
|
55
55
|
grpc_uri *grpc_uri_parse(grpc_exec_ctx *exec_ctx, const char *uri_text,
|
56
|
-
|
56
|
+
bool suppress_errors);
|
57
57
|
|
58
58
|
/** return the part of a query string after the '=' in "?key=xxx&...", or NULL
|
59
59
|
* if key is not present */
|
@@ -29,7 +29,7 @@
|
|
29
29
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
30
|
//
|
31
31
|
|
32
|
-
#include "src/core/
|
32
|
+
#include "src/core/ext/filters/deadline/deadline_filter.h"
|
33
33
|
|
34
34
|
#include <stdbool.h>
|
35
35
|
#include <string.h>
|
@@ -39,9 +39,11 @@
|
|
39
39
|
#include <grpc/support/sync.h>
|
40
40
|
#include <grpc/support/time.h>
|
41
41
|
|
42
|
+
#include "src/core/lib/channel/channel_stack_builder.h"
|
42
43
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
43
44
|
#include "src/core/lib/iomgr/timer.h"
|
44
45
|
#include "src/core/lib/slice/slice_internal.h"
|
46
|
+
#include "src/core/lib/surface/channel_init.h"
|
45
47
|
|
46
48
|
//
|
47
49
|
// grpc_deadline_state
|
@@ -141,18 +143,6 @@ static void inject_on_complete_cb(grpc_deadline_state* deadline_state,
|
|
141
143
|
op->on_complete = &deadline_state->on_complete;
|
142
144
|
}
|
143
145
|
|
144
|
-
void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
145
|
-
grpc_call_stack* call_stack) {
|
146
|
-
grpc_deadline_state* deadline_state = elem->call_data;
|
147
|
-
deadline_state->call_stack = call_stack;
|
148
|
-
}
|
149
|
-
|
150
|
-
void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
|
151
|
-
grpc_call_element* elem) {
|
152
|
-
grpc_deadline_state* deadline_state = elem->call_data;
|
153
|
-
cancel_timer_if_needed(exec_ctx, deadline_state);
|
154
|
-
}
|
155
|
-
|
156
146
|
// Callback and associated state for starting the timer after call stack
|
157
147
|
// initialization has been completed.
|
158
148
|
struct start_timer_after_init_state {
|
@@ -167,8 +157,11 @@ static void start_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
|
|
167
157
|
gpr_free(state);
|
168
158
|
}
|
169
159
|
|
170
|
-
void
|
171
|
-
|
160
|
+
void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
161
|
+
grpc_call_stack* call_stack,
|
162
|
+
gpr_timespec deadline) {
|
163
|
+
grpc_deadline_state* deadline_state = elem->call_data;
|
164
|
+
deadline_state->call_stack = call_stack;
|
172
165
|
// Deadline will always be infinite on servers, so the timer will only be
|
173
166
|
// set on clients with a finite deadline.
|
174
167
|
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
|
@@ -189,6 +182,12 @@ void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
|
189
182
|
}
|
190
183
|
}
|
191
184
|
|
185
|
+
void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
|
186
|
+
grpc_call_element* elem) {
|
187
|
+
grpc_deadline_state* deadline_state = elem->call_data;
|
188
|
+
cancel_timer_if_needed(exec_ctx, deadline_state);
|
189
|
+
}
|
190
|
+
|
192
191
|
void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
193
192
|
gpr_timespec new_deadline) {
|
194
193
|
grpc_deadline_state* deadline_state = elem->call_data;
|
@@ -248,8 +247,7 @@ typedef struct server_call_data {
|
|
248
247
|
static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
|
249
248
|
grpc_call_element* elem,
|
250
249
|
const grpc_call_element_args* args) {
|
251
|
-
grpc_deadline_state_init(exec_ctx, elem, args->call_stack);
|
252
|
-
grpc_deadline_state_start(exec_ctx, elem, args->deadline);
|
250
|
+
grpc_deadline_state_init(exec_ctx, elem, args->call_stack, args->deadline);
|
253
251
|
return GRPC_ERROR_NONE;
|
254
252
|
}
|
255
253
|
|
@@ -346,3 +344,30 @@ const grpc_channel_filter grpc_server_deadline_filter = {
|
|
346
344
|
grpc_channel_next_get_info,
|
347
345
|
"deadline",
|
348
346
|
};
|
347
|
+
|
348
|
+
bool grpc_deadline_checking_enabled(const grpc_channel_args* channel_args) {
|
349
|
+
return grpc_channel_arg_get_bool(
|
350
|
+
grpc_channel_args_find(channel_args, GRPC_ARG_ENABLE_DEADLINE_CHECKS),
|
351
|
+
!grpc_channel_args_want_minimal_stack(channel_args));
|
352
|
+
}
|
353
|
+
|
354
|
+
static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx,
|
355
|
+
grpc_channel_stack_builder* builder,
|
356
|
+
void* arg) {
|
357
|
+
return grpc_deadline_checking_enabled(
|
358
|
+
grpc_channel_stack_builder_get_channel_arguments(builder))
|
359
|
+
? grpc_channel_stack_builder_prepend_filter(builder, arg, NULL,
|
360
|
+
NULL)
|
361
|
+
: true;
|
362
|
+
}
|
363
|
+
|
364
|
+
void grpc_deadline_filter_init(void) {
|
365
|
+
grpc_channel_init_register_stage(
|
366
|
+
GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
|
367
|
+
maybe_add_deadline_filter, (void*)&grpc_client_deadline_filter);
|
368
|
+
grpc_channel_init_register_stage(
|
369
|
+
GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
|
370
|
+
maybe_add_deadline_filter, (void*)&grpc_server_deadline_filter);
|
371
|
+
}
|
372
|
+
|
373
|
+
void grpc_deadline_filter_shutdown(void) {}
|
@@ -29,8 +29,8 @@
|
|
29
29
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
30
|
//
|
31
31
|
|
32
|
-
#ifndef
|
33
|
-
#define
|
32
|
+
#ifndef GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H
|
33
|
+
#define GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H
|
34
34
|
|
35
35
|
#include "src/core/lib/channel/channel_stack.h"
|
36
36
|
#include "src/core/lib/iomgr/timer.h"
|
@@ -64,15 +64,11 @@ typedef struct grpc_deadline_state {
|
|
64
64
|
|
65
65
|
// assumes elem->call_data is zero'd
|
66
66
|
void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
67
|
-
grpc_call_stack* call_stack
|
67
|
+
grpc_call_stack* call_stack,
|
68
|
+
gpr_timespec deadline);
|
68
69
|
void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
|
69
70
|
grpc_call_element* elem);
|
70
71
|
|
71
|
-
// Starts the timer with the specified deadline.
|
72
|
-
// Should be called from the filter's init_call_elem() method.
|
73
|
-
void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
74
|
-
gpr_timespec deadline);
|
75
|
-
|
76
72
|
// Cancels the existing timer and starts a new one with new_deadline.
|
77
73
|
//
|
78
74
|
// Note: It is generally safe to call this with an earlier deadline
|
@@ -93,10 +89,13 @@ void grpc_deadline_state_client_start_transport_stream_op_batch(
|
|
93
89
|
grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
|
94
90
|
grpc_transport_stream_op_batch* op);
|
95
91
|
|
92
|
+
// Should deadline checking be performed (according to channel args)
|
93
|
+
bool grpc_deadline_checking_enabled(const grpc_channel_args* args);
|
94
|
+
|
96
95
|
// Deadline filters for direct client channels and server channels.
|
97
96
|
// Note: Deadlines for non-direct client channels are handled by the
|
98
97
|
// client_channel filter.
|
99
98
|
extern const grpc_channel_filter grpc_client_deadline_filter;
|
100
99
|
extern const grpc_channel_filter grpc_server_deadline_filter;
|
101
100
|
|
102
|
-
#endif /*
|
101
|
+
#endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */
|
@@ -30,7 +30,7 @@
|
|
30
30
|
*
|
31
31
|
*/
|
32
32
|
|
33
|
-
#include "src/core/
|
33
|
+
#include "src/core/ext/filters/http/client/http_client_filter.h"
|
34
34
|
#include <grpc/support/alloc.h>
|
35
35
|
#include <grpc/support/log.h>
|
36
36
|
#include <grpc/support/string_util.h>
|
@@ -220,10 +220,15 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx,
|
|
220
220
|
call_data *calld = elem->call_data;
|
221
221
|
uint8_t *wrptr = calld->payload_bytes;
|
222
222
|
while (grpc_byte_stream_next(
|
223
|
-
exec_ctx, calld->send_op->payload->send_message.send_message,
|
224
|
-
&calld->
|
225
|
-
|
226
|
-
|
223
|
+
exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0,
|
224
|
+
&calld->got_slice)) {
|
225
|
+
grpc_byte_stream_pull(exec_ctx,
|
226
|
+
calld->send_op->payload->send_message.send_message,
|
227
|
+
&calld->incoming_slice);
|
228
|
+
if (GRPC_SLICE_LENGTH(calld->incoming_slice) > 0) {
|
229
|
+
memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice),
|
230
|
+
GRPC_SLICE_LENGTH(calld->incoming_slice));
|
231
|
+
}
|
227
232
|
wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice);
|
228
233
|
grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
|
229
234
|
if (calld->send_length == calld->slices.length) {
|
@@ -237,6 +242,13 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
|
|
237
242
|
grpc_call_element *elem = elemp;
|
238
243
|
call_data *calld = elem->call_data;
|
239
244
|
calld->send_message_blocked = false;
|
245
|
+
if (GRPC_ERROR_NONE !=
|
246
|
+
grpc_byte_stream_pull(exec_ctx,
|
247
|
+
calld->send_op->payload->send_message.send_message,
|
248
|
+
&calld->incoming_slice)) {
|
249
|
+
/* Should never reach here */
|
250
|
+
abort();
|
251
|
+
}
|
240
252
|
grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
|
241
253
|
if (calld->send_length == calld->slices.length) {
|
242
254
|
/* Pass down the original send_message op that was blocked.*/
|
@@ -311,8 +323,7 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx,
|
|
311
323
|
estimated_len += grpc_base64_estimate_encoded_size(
|
312
324
|
op->payload->send_message.send_message->length, k_url_safe,
|
313
325
|
k_multi_line);
|
314
|
-
|
315
|
-
grpc_slice path_with_query_slice = grpc_slice_malloc(estimated_len);
|
326
|
+
grpc_slice path_with_query_slice = GRPC_SLICE_MALLOC(estimated_len);
|
316
327
|
|
317
328
|
/* memcopy individual pieces into this slice */
|
318
329
|
uint8_t *write_ptr =
|
@@ -332,10 +343,8 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx,
|
|
332
343
|
*/
|
333
344
|
char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice);
|
334
345
|
/* safe to use strlen since base64_encode will always add '\0' */
|
335
|
-
size_t path_length = strlen(t) + 1;
|
336
|
-
*(t + path_length) = '\0';
|
337
346
|
path_with_query_slice =
|
338
|
-
|
347
|
+
grpc_slice_sub_no_ref(path_with_query_slice, 0, strlen(t));
|
339
348
|
|
340
349
|
/* substitute previous path with the new path+query */
|
341
350
|
grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices(
|
@@ -349,7 +358,6 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx,
|
|
349
358
|
calld->on_complete = op->on_complete;
|
350
359
|
op->on_complete = &calld->hc_on_complete;
|
351
360
|
op->send_message = false;
|
352
|
-
grpc_slice_unref_internal(exec_ctx, path_with_query_slice);
|
353
361
|
} else {
|
354
362
|
/* Not all data is available. Fall back to POST. */
|
355
363
|
gpr_log(GPR_DEBUG,
|