grpc 1.0.1 → 1.1.2
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 +3696 -867
- data/etc/roots.pem +39 -111
- data/include/grpc/byte_buffer.h +64 -1
- data/include/grpc/census.h +40 -96
- data/include/grpc/compression.h +2 -1
- data/include/grpc/grpc.h +42 -7
- data/include/grpc/grpc_posix.h +8 -5
- data/include/grpc/impl/codegen/atm.h +3 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +2 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +8 -0
- data/include/grpc/impl/codegen/atm_windows.h +4 -0
- data/include/grpc/impl/codegen/byte_buffer_reader.h +4 -4
- data/include/grpc/impl/codegen/compression_types.h +1 -1
- data/include/grpc/impl/codegen/connectivity_state.h +2 -0
- data/include/grpc/impl/codegen/exec_ctx_fwd.h +41 -0
- data/include/grpc/impl/codegen/gpr_slice.h +84 -0
- data/include/grpc/impl/codegen/{alloc.h → gpr_types.h} +30 -29
- data/include/grpc/impl/codegen/grpc_types.h +91 -9
- data/include/grpc/impl/codegen/port_platform.h +25 -92
- data/include/grpc/impl/codegen/slice.h +54 -97
- data/include/grpc/impl/codegen/sync.h +0 -253
- data/include/grpc/module.modulemap +0 -2
- data/include/grpc/slice.h +132 -0
- data/include/grpc/{impl/codegen/slice_buffer.h → slice_buffer.h} +22 -39
- data/include/grpc/support/alloc.h +40 -1
- data/include/grpc/support/log.h +80 -1
- data/include/grpc/support/log_windows.h +2 -0
- data/include/grpc/support/string_util.h +1 -1
- data/include/grpc/support/sync.h +252 -0
- data/include/grpc/support/time.h +67 -1
- data/src/boringssl/err_data.c +639 -627
- data/src/core/ext/census/base_resources.c +71 -0
- data/src/core/ext/census/base_resources.h +39 -0
- data/src/core/ext/census/gen/census.pb.c +26 -29
- data/src/core/ext/census/gen/census.pb.h +68 -67
- data/src/core/ext/census/gen/trace_context.pb.c +81 -0
- data/src/core/ext/census/gen/trace_context.pb.h +99 -0
- data/src/core/ext/census/grpc_filter.c +22 -16
- data/src/core/ext/census/grpc_plugin.c +2 -1
- data/src/core/ext/census/initialize.c +16 -4
- data/src/core/ext/census/mlog.h +1 -1
- data/src/core/ext/census/placeholders.c +0 -45
- data/src/core/ext/census/resource.c +312 -0
- data/src/core/ext/census/resource.h +63 -0
- data/src/core/ext/census/trace_context.c +86 -0
- data/src/core/ext/census/trace_context.h +68 -0
- data/src/core/ext/census/tracing.c +8 -2
- data/src/core/ext/{client_config → client_channel}/channel_connectivity.c +8 -4
- data/src/core/ext/client_channel/client_channel.c +1218 -0
- data/src/core/ext/{client_config → client_channel}/client_channel.h +8 -11
- data/src/core/ext/{client_config → client_channel}/client_channel_factory.c +33 -3
- data/src/core/ext/{client_config → client_channel}/client_channel_factory.h +15 -8
- data/src/core/ext/{client_config/client_config_plugin.c → client_channel/client_channel_plugin.c} +16 -15
- data/src/core/ext/{client_config → client_channel}/connector.c +1 -1
- data/src/core/ext/{client_config → client_channel}/connector.h +5 -8
- data/{include/grpc/support/slice_buffer.h → src/core/ext/client_channel/default_initial_connect_string.c} +4 -5
- data/src/core/ext/client_channel/http_connect_handshaker.c +399 -0
- data/src/core/ext/client_channel/http_connect_handshaker.h +52 -0
- data/src/core/ext/{client_config → client_channel}/initial_connect_string.c +6 -7
- data/src/core/ext/{client_config → client_channel}/initial_connect_string.h +10 -10
- data/src/core/ext/{client_config → client_channel}/lb_policy.c +11 -11
- data/src/core/ext/{client_config → client_channel}/lb_policy.h +68 -27
- data/src/core/ext/client_channel/lb_policy_factory.c +163 -0
- data/src/core/ext/{client_config → client_channel}/lb_policy_factory.h +64 -9
- data/src/core/ext/{client_config → client_channel}/lb_policy_registry.c +6 -4
- data/src/core/ext/{client_config → client_channel}/lb_policy_registry.h +4 -4
- data/src/core/ext/{client_config → client_channel}/parse_address.c +21 -14
- data/src/core/ext/{client_config → client_channel}/parse_address.h +8 -10
- data/src/core/ext/{client_config → client_channel}/resolver.c +3 -4
- data/src/core/ext/{client_config → client_channel}/resolver.h +11 -15
- data/src/core/ext/{client_config → client_channel}/resolver_factory.c +4 -3
- data/src/core/ext/{client_config → client_channel}/resolver_factory.h +13 -11
- data/src/core/ext/{client_config → client_channel}/resolver_registry.c +54 -34
- data/src/core/ext/{client_config → client_channel}/resolver_registry.h +21 -8
- data/src/core/ext/{client_config → client_channel}/subchannel.c +208 -119
- data/src/core/ext/{client_config → client_channel}/subchannel.h +21 -11
- data/src/core/ext/{client_config → client_channel}/subchannel_index.c +6 -17
- data/src/core/ext/{client_config → client_channel}/subchannel_index.h +7 -7
- data/src/core/ext/{client_config → client_channel}/uri_parser.c +21 -28
- data/src/core/ext/{client_config → client_channel}/uri_parser.h +3 -3
- data/src/core/ext/lb_policy/grpclb/grpclb.c +1406 -0
- data/src/core/ext/lb_policy/grpclb/grpclb.h +44 -0
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.c +117 -37
- data/src/core/ext/lb_policy/grpclb/load_balancer_api.h +31 -12
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +6 -36
- data/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +22 -42
- data/src/core/ext/lb_policy/pick_first/pick_first.c +64 -46
- data/src/core/ext/lb_policy/round_robin/round_robin.c +324 -160
- data/src/core/ext/load_reporting/load_reporting.c +7 -56
- data/src/core/ext/load_reporting/load_reporting.h +41 -28
- data/src/core/ext/load_reporting/load_reporting_filter.c +132 -42
- data/src/core/ext/load_reporting/load_reporting_filter.h +1 -0
- data/src/core/ext/resolver/dns/native/dns_resolver.c +88 -80
- data/src/core/ext/resolver/sockaddr/sockaddr_resolver.c +57 -102
- data/src/core/ext/transport/chttp2/alpn/alpn.c +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +253 -0
- data/src/core/{lib/iomgr/ev_poll_and_epoll_posix.h → ext/transport/chttp2/client/chttp2_connector.h} +5 -5
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +31 -160
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +5 -5
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +44 -243
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +342 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +47 -0
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +11 -124
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +20 -9
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +28 -236
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +31 -27
- data/src/core/ext/transport/chttp2/transport/bin_decoder.h +5 -4
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +25 -22
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +8 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +0 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +1345 -1521
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -1
- data/src/core/ext/transport/chttp2/transport/frame.h +3 -5
- data/src/core/ext/transport/chttp2/transport/frame_data.c +50 -47
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -9
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +19 -21
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +9 -8
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +13 -12
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +6 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +31 -19
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +8 -7
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +22 -25
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +9 -8
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +26 -18
- data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -6
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +68 -58
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +8 -5
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +327 -214
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +14 -9
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +24 -19
- data/src/core/ext/transport/chttp2/transport/hpack_table.h +9 -6
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +284 -436
- data/src/core/ext/transport/chttp2/transport/parsing.c +355 -590
- data/src/core/ext/transport/chttp2/transport/stream_lists.c +36 -309
- data/src/core/ext/transport/chttp2/transport/stream_map.c +13 -34
- data/src/core/ext/transport/chttp2/transport/stream_map.h +3 -4
- data/src/core/ext/transport/chttp2/transport/writing.c +174 -286
- data/src/core/lib/channel/channel_args.c +70 -13
- data/src/core/lib/channel/channel_args.h +28 -2
- data/src/core/lib/channel/channel_stack.c +77 -28
- data/src/core/lib/channel/channel_stack.h +61 -23
- data/src/core/lib/channel/channel_stack_builder.c +33 -25
- data/src/core/lib/channel/channel_stack_builder.h +17 -8
- data/src/core/lib/channel/compress_filter.c +52 -36
- data/src/core/lib/channel/connected_channel.c +20 -12
- data/src/core/lib/channel/connected_channel.h +2 -1
- data/src/core/lib/channel/context.h +13 -1
- data/src/core/lib/channel/deadline_filter.c +344 -0
- data/src/core/lib/channel/deadline_filter.h +99 -0
- data/src/core/lib/channel/handshaker.c +240 -0
- data/src/core/lib/channel/handshaker.h +164 -0
- data/src/core/lib/{security/credentials/google_default/credentials_windows.c → channel/handshaker_factory.c} +16 -23
- data/src/core/lib/channel/handshaker_factory.h +66 -0
- data/src/core/lib/channel/handshaker_registry.c +113 -0
- data/src/core/{ext/client_config/client_config.h → lib/channel/handshaker_registry.h} +26 -16
- data/src/core/lib/channel/http_client_filter.c +248 -46
- data/src/core/lib/channel/http_client_filter.h +3 -0
- data/src/core/lib/channel/http_server_filter.c +136 -24
- data/src/core/lib/channel/message_size_filter.c +261 -0
- data/src/core/lib/channel/message_size_filter.h +39 -0
- data/src/core/lib/compression/message_compress.c +43 -37
- data/src/core/lib/compression/message_compress.h +7 -5
- data/src/core/lib/http/format_request.c +26 -11
- data/src/core/lib/http/format_request.h +7 -5
- data/src/core/lib/http/httpcli.c +45 -27
- data/src/core/lib/http/httpcli.h +4 -4
- data/src/core/lib/http/httpcli_security_connector.c +56 -46
- data/src/core/lib/http/parser.c +17 -14
- data/src/core/lib/http/parser.h +4 -2
- data/src/core/lib/iomgr/closure.c +49 -7
- data/src/core/lib/iomgr/closure.h +56 -14
- data/src/core/lib/iomgr/combiner.c +422 -0
- data/src/core/lib/iomgr/combiner.h +64 -0
- data/src/core/lib/iomgr/endpoint.c +8 -2
- data/src/core/lib/iomgr/endpoint.h +17 -7
- data/src/core/lib/iomgr/endpoint_pair.h +3 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.c +9 -8
- data/src/core/{ext/client_config/lb_policy_factory.c → lib/iomgr/endpoint_pair_uv.c} +18 -13
- data/src/core/lib/iomgr/endpoint_pair_windows.c +7 -6
- data/src/core/lib/iomgr/error.c +72 -6
- data/src/core/lib/iomgr/error.h +30 -3
- data/src/core/lib/iomgr/ev_epoll_linux.c +500 -382
- data/src/core/lib/iomgr/ev_epoll_linux.h +3 -2
- data/src/core/lib/iomgr/ev_poll_posix.c +317 -30
- data/src/core/lib/iomgr/ev_poll_posix.h +1 -0
- data/src/core/lib/iomgr/ev_posix.c +26 -5
- data/src/core/lib/iomgr/ev_posix.h +12 -1
- data/src/core/lib/iomgr/exec_ctx.c +27 -94
- data/src/core/lib/iomgr/exec_ctx.h +19 -22
- data/src/core/lib/iomgr/executor.c +29 -8
- data/src/core/lib/iomgr/executor.h +2 -4
- data/src/core/lib/iomgr/iocp_windows.c +3 -4
- data/src/core/lib/iomgr/iomgr.c +14 -10
- data/src/core/lib/iomgr/iomgr.h +6 -2
- data/src/core/lib/iomgr/iomgr_posix.c +2 -2
- data/src/core/lib/iomgr/iomgr_uv.c +49 -0
- data/src/core/lib/iomgr/iomgr_windows.c +2 -2
- data/src/core/lib/iomgr/load_file.c +3 -3
- data/src/core/lib/iomgr/load_file.h +2 -2
- data/src/core/lib/iomgr/network_status_tracker.c +1 -1
- data/src/core/lib/iomgr/pollset_set_uv.c +62 -0
- data/src/core/lib/iomgr/pollset_set_windows.c +3 -3
- data/src/core/lib/iomgr/pollset_uv.c +142 -0
- data/src/core/lib/iomgr/pollset_uv.h +42 -0
- data/src/core/lib/iomgr/pollset_windows.c +5 -6
- data/src/core/lib/iomgr/port.h +129 -0
- data/src/core/lib/iomgr/resolve_address.h +2 -1
- data/src/core/lib/iomgr/resolve_address_posix.c +14 -13
- data/src/core/lib/iomgr/resolve_address_uv.c +233 -0
- data/src/core/lib/iomgr/resolve_address_windows.c +14 -12
- data/src/core/lib/iomgr/resource_quota.c +832 -0
- data/src/core/lib/iomgr/resource_quota.h +159 -0
- data/src/core/lib/iomgr/sockaddr.h +10 -2
- data/src/core/lib/iomgr/sockaddr_utils.c +63 -36
- data/src/core/lib/iomgr/sockaddr_utils.h +14 -14
- data/src/core/lib/iomgr/socket_mutator.c +98 -0
- data/src/core/lib/iomgr/socket_mutator.h +80 -0
- data/src/core/lib/iomgr/socket_utils.h +42 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.c +28 -13
- data/src/core/lib/iomgr/socket_utils_linux.c +11 -5
- data/src/core/lib/iomgr/socket_utils_posix.c +10 -7
- data/src/core/lib/iomgr/socket_utils_posix.h +11 -4
- data/src/core/lib/iomgr/socket_utils_uv.c +49 -0
- data/src/core/lib/iomgr/socket_utils_windows.c +52 -0
- data/src/core/lib/iomgr/socket_windows.c +14 -6
- data/src/core/lib/iomgr/socket_windows.h +1 -0
- data/src/core/lib/iomgr/tcp_client.h +8 -2
- data/src/core/lib/iomgr/tcp_client_posix.c +131 -82
- data/src/core/lib/iomgr/tcp_client_posix.h +45 -0
- data/src/core/lib/iomgr/tcp_client_uv.c +190 -0
- data/src/core/lib/iomgr/tcp_client_windows.c +54 -30
- data/src/core/lib/iomgr/tcp_posix.c +135 -56
- data/src/core/lib/iomgr/tcp_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server.h +14 -6
- data/src/core/lib/iomgr/tcp_server_posix.c +154 -118
- data/src/core/lib/iomgr/tcp_server_uv.c +388 -0
- data/src/core/lib/iomgr/tcp_server_windows.c +127 -100
- data/src/core/lib/iomgr/tcp_uv.c +367 -0
- data/src/core/lib/iomgr/tcp_uv.h +59 -0
- data/src/core/lib/iomgr/tcp_windows.c +65 -48
- data/src/core/lib/iomgr/tcp_windows.h +3 -1
- data/src/core/lib/iomgr/timer.h +21 -21
- data/src/core/lib/iomgr/{timer.c → timer_generic.c} +15 -10
- data/src/core/lib/iomgr/timer_generic.h +49 -0
- data/src/core/lib/iomgr/timer_heap.c +6 -0
- data/src/core/lib/iomgr/timer_uv.c +99 -0
- data/src/core/lib/iomgr/timer_uv.h +47 -0
- data/src/core/lib/iomgr/udp_server.c +116 -98
- data/src/core/lib/iomgr/udp_server.h +5 -3
- data/src/core/lib/iomgr/unix_sockets_posix.c +14 -6
- data/src/core/lib/iomgr/unix_sockets_posix.h +6 -5
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +4 -4
- data/src/core/lib/iomgr/wakeup_fd_cv.c +118 -0
- data/src/core/lib/iomgr/wakeup_fd_cv.h +80 -0
- data/src/core/lib/iomgr/wakeup_fd_eventfd.c +3 -3
- data/src/core/lib/iomgr/wakeup_fd_nospecial.c +3 -3
- data/src/core/lib/iomgr/wakeup_fd_pipe.c +12 -6
- data/src/core/lib/iomgr/wakeup_fd_posix.c +34 -5
- data/src/core/lib/iomgr/wakeup_fd_posix.h +5 -0
- data/src/core/lib/iomgr/workqueue.h +12 -20
- data/src/core/{ext/client_config/client_config.c → lib/iomgr/workqueue_uv.c} +24 -33
- data/{include/grpc/support/slice.h → src/core/lib/iomgr/workqueue_uv.h} +4 -6
- data/src/core/lib/iomgr/workqueue_windows.c +9 -8
- data/src/core/lib/json/json.c +3 -3
- data/src/core/lib/json/json.h +11 -11
- data/src/core/lib/json/json_reader.c +9 -5
- data/src/core/lib/profiling/basic_timers.c +10 -1
- data/src/core/lib/profiling/timers.h +2 -0
- data/src/core/lib/security/context/security_context.c +13 -3
- data/src/core/lib/security/context/security_context.h +20 -0
- data/src/core/lib/security/credentials/composite/composite_credentials.c +28 -14
- data/src/core/lib/security/credentials/composite/composite_credentials.h +2 -2
- data/src/core/lib/security/credentials/credentials.c +48 -19
- data/src/core/lib/security/credentials/credentials.h +36 -19
- data/src/core/lib/security/credentials/credentials_metadata.c +11 -8
- data/src/core/lib/security/credentials/fake/fake_credentials.c +15 -11
- data/src/core/lib/security/credentials/google_default/{credentials_posix.c → credentials_generic.c} +7 -14
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +33 -21
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +14 -0
- data/src/core/lib/security/credentials/iam/iam_credentials.c +3 -2
- data/src/core/lib/security/credentials/jwt/json_token.c +1 -0
- data/src/core/lib/security/credentials/jwt/json_token.h +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +54 -19
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +2 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +129 -79
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +9 -6
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +63 -28
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +1 -1
- data/src/core/lib/security/credentials/plugin/plugin_credentials.c +32 -11
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +13 -9
- data/src/core/lib/security/transport/client_auth_filter.c +33 -27
- data/src/core/lib/security/transport/secure_endpoint.c +93 -68
- data/src/core/lib/security/transport/secure_endpoint.h +2 -2
- data/src/core/lib/security/transport/security_connector.c +133 -168
- data/src/core/lib/security/transport/security_connector.h +31 -46
- data/src/core/lib/security/transport/security_handshaker.c +501 -0
- data/src/core/lib/security/transport/{handshake.h → security_handshaker.h} +10 -10
- data/src/core/lib/security/transport/server_auth_filter.c +50 -38
- data/src/core/lib/security/util/b64.c +11 -8
- data/src/core/lib/security/util/b64.h +5 -4
- data/src/core/lib/slice/percent_encoding.c +182 -0
- data/src/core/lib/slice/percent_encoding.h +78 -0
- data/src/core/lib/{support → slice}/slice.c +81 -50
- data/src/core/lib/{support → slice}/slice_buffer.c +78 -60
- data/src/core/lib/slice/slice_internal.h +49 -0
- data/src/core/lib/slice/slice_string_helpers.c +90 -0
- data/src/core/lib/{iomgr/workqueue_posix.h → slice/slice_string_helpers.h} +18 -18
- data/src/core/lib/support/backoff.c +24 -13
- data/src/core/lib/support/backoff.h +5 -2
- data/src/core/lib/support/env.h +0 -2
- data/src/core/lib/support/log.c +5 -4
- data/src/core/lib/support/log_linux.c +0 -1
- data/src/core/lib/support/log_posix.c +1 -1
- data/src/core/lib/support/mpscq.c +83 -0
- data/src/core/lib/support/mpscq.h +65 -0
- data/src/core/lib/support/string.c +58 -49
- data/src/core/lib/support/string.h +11 -8
- data/src/core/lib/support/subprocess_posix.c +5 -2
- data/src/core/lib/support/thd.c +1 -1
- data/src/core/lib/support/time.c +43 -79
- data/src/core/lib/support/time_posix.c +1 -1
- data/src/core/lib/support/tmpfile.h +0 -2
- data/src/core/lib/surface/alarm.c +4 -1
- data/src/core/lib/surface/byte_buffer.c +17 -11
- data/src/core/lib/surface/byte_buffer_reader.c +23 -15
- data/src/core/lib/surface/call.c +294 -276
- data/src/core/lib/surface/call.h +24 -9
- data/src/core/lib/surface/call_log_batch.c +5 -3
- data/src/core/lib/surface/channel.c +127 -111
- data/src/core/lib/surface/channel.h +14 -5
- data/src/core/lib/surface/channel_init.c +1 -1
- data/src/core/lib/surface/channel_init.h +10 -1
- data/src/core/lib/surface/channel_ping.c +7 -6
- data/src/core/lib/surface/completion_queue.c +154 -18
- data/src/core/lib/surface/completion_queue.h +5 -0
- data/src/core/lib/surface/init.c +40 -6
- data/src/core/lib/surface/init.h +1 -0
- data/src/core/lib/surface/init_secure.c +5 -2
- data/src/core/lib/surface/lame_client.c +28 -18
- data/src/core/lib/surface/server.c +134 -87
- data/src/core/lib/surface/server.h +8 -0
- data/src/core/lib/surface/validate_metadata.c +1 -1
- data/src/core/lib/surface/version.c +3 -1
- data/src/core/lib/transport/byte_stream.c +7 -4
- data/src/core/lib/transport/byte_stream.h +6 -10
- data/src/core/lib/transport/connectivity_state.c +21 -12
- data/src/core/lib/transport/connectivity_state.h +4 -1
- data/src/core/lib/transport/mdstr_hash_table.c +118 -0
- data/src/core/lib/transport/mdstr_hash_table.h +77 -0
- data/src/core/lib/transport/metadata.c +83 -60
- data/src/core/lib/transport/metadata.h +41 -23
- data/src/core/lib/transport/metadata_batch.c +17 -11
- data/src/core/lib/transport/metadata_batch.h +20 -6
- data/src/core/lib/transport/pid_controller.c +57 -0
- data/src/core/lib/transport/pid_controller.h +64 -0
- data/src/core/lib/transport/service_config.c +251 -0
- data/src/core/lib/transport/service_config.h +71 -0
- data/src/core/lib/transport/static_metadata.c +18 -16
- data/src/core/lib/transport/static_metadata.h +113 -107
- data/src/core/{ext/transport/chttp2 → lib}/transport/timeout_encoding.c +3 -3
- data/src/core/{ext/transport/chttp2 → lib}/transport/timeout_encoding.h +7 -7
- data/src/core/lib/transport/transport.c +84 -23
- data/src/core/lib/transport/transport.h +53 -8
- data/src/core/lib/transport/transport_impl.h +3 -0
- data/src/core/lib/transport/transport_op_string.c +92 -20
- data/src/core/lib/tsi/ssl_transport_security.c +3 -1
- data/src/core/plugin_registry/grpc_plugin_registry.c +8 -4
- data/src/ruby/ext/grpc/extconf.rb +0 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -7
- data/src/ruby/ext/grpc/rb_call.c +15 -5
- data/src/ruby/ext/grpc/rb_channel.c +1 -1
- data/src/ruby/ext/grpc/rb_compression_options.c +466 -0
- data/src/{core/ext/client_config/default_initial_connect_string.c → ruby/ext/grpc/rb_compression_options.h} +10 -5
- data/src/ruby/ext/grpc/rb_grpc.c +3 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +198 -190
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +306 -294
- data/src/ruby/ext/grpc/rb_server.c +18 -12
- data/src/ruby/lib/grpc/errors.rb +154 -2
- data/src/ruby/lib/grpc/generic/active_call.rb +144 -63
- data/src/ruby/lib/grpc/generic/bidi_call.rb +18 -2
- data/src/ruby/lib/grpc/generic/client_stub.rb +7 -5
- data/src/ruby/lib/grpc/generic/rpc_desc.rb +39 -13
- data/src/ruby/lib/grpc/generic/rpc_server.rb +51 -24
- data/src/ruby/lib/grpc/generic/service.rb +3 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +3 -1
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +7 -0
- data/src/ruby/pb/test/client.rb +307 -7
- data/src/ruby/pb/test/server.rb +26 -1
- data/src/ruby/spec/compression_options_spec.rb +164 -0
- data/src/ruby/spec/error_sanity_spec.rb +64 -0
- data/src/ruby/spec/generic/active_call_spec.rb +290 -12
- data/src/ruby/spec/generic/client_stub_spec.rb +91 -41
- data/src/ruby/spec/generic/rpc_desc_spec.rb +36 -16
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +22 -28
- data/src/ruby/spec/generic/rpc_server_spec.rb +6 -6
- data/src/ruby/spec/pb/health/checker_spec.rb +27 -19
- data/src/ruby/spec/spec_helper.rb +2 -0
- data/third_party/boringssl/crypto/aes/aes.c +12 -12
- data/third_party/boringssl/crypto/aes/mode_wrappers.c +6 -2
- data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +28 -13
- data/third_party/boringssl/crypto/asn1/a_gentm.c +2 -0
- data/third_party/boringssl/crypto/asn1/a_object.c +7 -3
- data/third_party/boringssl/crypto/asn1/a_strnid.c +1 -0
- data/third_party/boringssl/crypto/asn1/a_time.c +0 -11
- data/third_party/boringssl/crypto/asn1/a_type.c +0 -2
- data/third_party/boringssl/crypto/asn1/a_utctm.c +1 -30
- data/third_party/boringssl/crypto/asn1/asn1_lib.c +56 -76
- data/third_party/boringssl/crypto/asn1/asn1_locl.h +0 -10
- data/third_party/boringssl/crypto/asn1/asn1_par.c +0 -322
- data/third_party/boringssl/crypto/asn1/f_enum.c +1 -108
- data/third_party/boringssl/crypto/asn1/f_int.c +1 -106
- data/third_party/boringssl/crypto/asn1/f_string.c +1 -106
- data/third_party/boringssl/crypto/asn1/tasn_dec.c +10 -14
- data/third_party/boringssl/crypto/asn1/tasn_enc.c +17 -11
- data/third_party/boringssl/crypto/asn1/tasn_typ.c +29 -42
- data/third_party/boringssl/crypto/asn1/tasn_utl.c +1 -1
- data/third_party/boringssl/crypto/base64/base64.c +249 -285
- data/third_party/boringssl/crypto/bio/bio.c +13 -23
- data/third_party/boringssl/crypto/bio/bio_mem.c +3 -2
- data/third_party/boringssl/crypto/bio/connect.c +12 -3
- data/third_party/boringssl/crypto/bio/fd.c +22 -15
- data/third_party/boringssl/crypto/bio/file.c +2 -38
- data/third_party/boringssl/crypto/bio/hexdump.c +1 -2
- data/third_party/boringssl/crypto/bio/internal.h +3 -0
- data/third_party/boringssl/crypto/bio/pair.c +1 -1
- data/third_party/boringssl/crypto/bio/socket.c +10 -2
- data/third_party/boringssl/crypto/bio/socket_helper.c +2 -2
- data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +0 -8
- data/third_party/boringssl/crypto/bn/bn.c +38 -0
- data/third_party/boringssl/crypto/bn/cmp.c +25 -0
- data/third_party/boringssl/crypto/bn/convert.c +73 -76
- data/third_party/boringssl/crypto/bn/div.c +136 -70
- data/third_party/boringssl/crypto/bn/exponentiation.c +86 -381
- data/third_party/boringssl/crypto/bn/gcd.c +213 -296
- data/third_party/boringssl/crypto/bn/generic.c +0 -80
- data/third_party/boringssl/crypto/bn/internal.h +15 -3
- data/third_party/boringssl/crypto/bn/montgomery.c +57 -207
- data/third_party/boringssl/crypto/bn/montgomery_inv.c +160 -0
- data/third_party/boringssl/crypto/bn/mul.c +2 -1
- data/third_party/boringssl/crypto/bn/prime.c +24 -8
- data/third_party/boringssl/crypto/bn/random.c +47 -33
- data/third_party/boringssl/crypto/bn/sqrt.c +4 -5
- data/third_party/boringssl/crypto/buf/buf.c +25 -21
- data/third_party/boringssl/crypto/bytestring/ber.c +1 -0
- data/third_party/boringssl/crypto/bytestring/cbb.c +50 -22
- data/third_party/boringssl/crypto/bytestring/cbs.c +28 -4
- data/third_party/boringssl/crypto/chacha/{chacha_generic.c → chacha.c} +56 -29
- data/third_party/boringssl/crypto/cipher/aead.c +11 -22
- data/third_party/boringssl/crypto/cipher/cipher.c +2 -2
- data/third_party/boringssl/crypto/cipher/e_aes.c +53 -103
- data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +2 -8
- data/third_party/boringssl/crypto/cipher/e_des.c +3 -5
- data/third_party/boringssl/crypto/cipher/e_null.c +1 -1
- data/third_party/boringssl/crypto/cipher/e_rc2.c +1 -1
- data/third_party/boringssl/crypto/cipher/e_rc4.c +1 -1
- data/third_party/boringssl/crypto/cipher/e_ssl3.c +3 -63
- data/third_party/boringssl/crypto/cipher/e_tls.c +12 -83
- data/third_party/boringssl/crypto/cipher/internal.h +8 -10
- data/third_party/boringssl/crypto/cipher/tls_cbc.c +69 -40
- data/third_party/boringssl/crypto/conf/conf.c +2 -1
- data/third_party/boringssl/crypto/cpu-aarch64-linux.c +61 -0
- data/third_party/boringssl/crypto/cpu-arm-linux.c +360 -0
- data/third_party/boringssl/crypto/cpu-arm.c +0 -161
- data/third_party/boringssl/crypto/cpu-intel.c +5 -3
- data/third_party/boringssl/{ssl/test/scoped_types.h → crypto/cpu-ppc64le.c} +21 -9
- data/third_party/boringssl/crypto/crypto.c +29 -7
- data/third_party/boringssl/crypto/curve25519/curve25519.c +284 -242
- data/third_party/boringssl/crypto/curve25519/internal.h +64 -0
- data/third_party/boringssl/crypto/curve25519/spake25519.c +464 -0
- data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +21 -0
- data/third_party/boringssl/crypto/dh/check.c +22 -6
- data/third_party/boringssl/crypto/dh/dh.c +45 -21
- data/third_party/boringssl/crypto/dh/dh_asn1.c +96 -20
- data/third_party/boringssl/crypto/dh/params.c +30 -78
- data/third_party/boringssl/crypto/digest/digest.c +3 -3
- data/third_party/boringssl/crypto/dsa/dsa.c +59 -29
- data/third_party/boringssl/crypto/dsa/dsa_asn1.c +4 -0
- data/third_party/boringssl/crypto/ec/ec.c +84 -140
- data/third_party/boringssl/crypto/ec/ec_asn1.c +82 -52
- data/third_party/boringssl/crypto/ec/ec_key.c +15 -15
- data/third_party/boringssl/crypto/ec/ec_montgomery.c +87 -50
- data/third_party/boringssl/crypto/ec/internal.h +12 -36
- data/third_party/boringssl/crypto/ec/oct.c +11 -11
- data/third_party/boringssl/crypto/ec/p224-64.c +59 -116
- data/third_party/boringssl/crypto/ec/p256-64.c +88 -163
- data/third_party/boringssl/crypto/ec/p256-x86_64.c +46 -58
- data/third_party/boringssl/crypto/ec/simple.c +81 -201
- data/third_party/boringssl/crypto/ec/util-64.c +0 -74
- data/third_party/boringssl/crypto/ecdh/ecdh.c +7 -1
- data/third_party/boringssl/crypto/ecdsa/ecdsa.c +28 -46
- data/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c +1 -0
- data/third_party/boringssl/crypto/engine/engine.c +1 -1
- data/third_party/boringssl/crypto/err/err.c +3 -3
- data/third_party/boringssl/crypto/evp/evp.c +14 -59
- data/third_party/boringssl/crypto/evp/evp_asn1.c +144 -87
- data/third_party/boringssl/crypto/evp/evp_ctx.c +7 -7
- data/third_party/boringssl/crypto/evp/internal.h +4 -46
- data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +8 -157
- data/third_party/boringssl/crypto/evp/p_ec.c +1 -1
- data/third_party/boringssl/crypto/evp/p_ec_asn1.c +22 -170
- data/third_party/boringssl/crypto/evp/p_rsa.c +1 -1
- data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +10 -548
- data/third_party/boringssl/crypto/evp/print.c +520 -0
- data/third_party/boringssl/crypto/ex_data.c +4 -6
- data/third_party/boringssl/crypto/hkdf/hkdf.c +38 -17
- data/third_party/boringssl/crypto/hmac/hmac.c +6 -6
- data/third_party/boringssl/crypto/internal.h +57 -77
- data/third_party/boringssl/crypto/lhash/lhash.c +6 -10
- data/third_party/boringssl/crypto/md4/md4.c +9 -0
- data/third_party/boringssl/crypto/mem.c +19 -19
- data/third_party/boringssl/crypto/modes/cfb.c +5 -6
- data/third_party/boringssl/crypto/modes/ctr.c +10 -18
- data/third_party/boringssl/crypto/modes/gcm.c +100 -66
- data/third_party/boringssl/crypto/modes/internal.h +15 -27
- data/third_party/boringssl/crypto/modes/ofb.c +9 -22
- data/third_party/boringssl/crypto/newhope/error_correction.c +131 -0
- data/third_party/boringssl/crypto/newhope/internal.h +71 -0
- data/third_party/boringssl/crypto/newhope/newhope.c +174 -0
- data/third_party/boringssl/crypto/newhope/ntt.c +148 -0
- data/third_party/boringssl/crypto/newhope/poly.c +183 -0
- data/third_party/boringssl/crypto/newhope/precomp.c +306 -0
- data/third_party/boringssl/crypto/newhope/reduce.c +42 -0
- data/third_party/boringssl/crypto/obj/obj.c +111 -135
- data/third_party/boringssl/crypto/obj/obj_dat.h +4 -10
- data/third_party/boringssl/crypto/pem/pem_lib.c +6 -43
- data/third_party/boringssl/crypto/pem/pem_pkey.c +10 -19
- data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +1 -0
- data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +2 -1
- data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +2 -2
- data/third_party/boringssl/crypto/pkcs8/pkcs8.c +95 -87
- data/third_party/boringssl/crypto/{test/test_util.h → poly1305/internal.h} +15 -10
- data/third_party/boringssl/crypto/poly1305/poly1305.c +8 -15
- data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +1 -0
- data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +3 -3
- data/third_party/boringssl/crypto/rand/deterministic.c +47 -0
- data/third_party/boringssl/crypto/rand/rand.c +4 -1
- data/third_party/boringssl/crypto/rand/urandom.c +5 -7
- data/third_party/boringssl/crypto/rand/windows.c +5 -8
- data/third_party/boringssl/crypto/rc4/rc4.c +24 -209
- data/third_party/boringssl/crypto/refcount_lock.c +2 -2
- data/third_party/boringssl/crypto/rsa/blinding.c +74 -232
- data/third_party/boringssl/crypto/rsa/internal.h +5 -13
- data/third_party/boringssl/crypto/rsa/padding.c +64 -63
- data/third_party/boringssl/crypto/rsa/rsa.c +50 -28
- data/third_party/boringssl/crypto/rsa/rsa_asn1.c +8 -16
- data/third_party/boringssl/crypto/rsa/rsa_impl.c +134 -122
- data/third_party/boringssl/crypto/sha/sha256.c +2 -2
- data/third_party/boringssl/crypto/sha/sha512.c +7 -7
- data/third_party/boringssl/crypto/stack/stack.c +13 -22
- data/third_party/boringssl/crypto/thread.c +21 -12
- data/third_party/boringssl/crypto/thread_none.c +6 -2
- data/third_party/boringssl/crypto/thread_pthread.c +16 -7
- data/third_party/boringssl/crypto/thread_win.c +38 -85
- data/third_party/boringssl/crypto/x509/a_sign.c +3 -3
- data/third_party/boringssl/crypto/x509/a_strex.c +1 -1
- data/third_party/boringssl/crypto/x509/a_verify.c +2 -2
- data/third_party/boringssl/crypto/{evp → x509}/algorithm.c +37 -53
- data/third_party/boringssl/crypto/x509/asn1_gen.c +1 -2
- data/third_party/boringssl/crypto/x509/by_dir.c +6 -6
- data/third_party/boringssl/crypto/x509/internal.h +66 -0
- data/third_party/boringssl/crypto/x509/rsa_pss.c +385 -0
- data/third_party/boringssl/crypto/x509/t_x509.c +10 -12
- data/third_party/boringssl/crypto/x509/x509.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_att.c +9 -3
- data/third_party/boringssl/crypto/x509/x509_lu.c +34 -44
- data/third_party/boringssl/crypto/x509/x509_obj.c +19 -2
- data/third_party/boringssl/crypto/x509/x509_r2x.c +9 -5
- data/third_party/boringssl/crypto/x509/x509_set.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_txt.c +5 -0
- data/third_party/boringssl/crypto/x509/x509_vfy.c +63 -32
- data/third_party/boringssl/crypto/x509/x509_vpm.c +29 -18
- data/third_party/boringssl/crypto/x509/x509cset.c +2 -1
- data/third_party/boringssl/crypto/x509/x_crl.c +2 -2
- data/third_party/boringssl/crypto/x509/x_name.c +14 -17
- data/third_party/boringssl/crypto/x509/x_pubkey.c +10 -7
- data/third_party/boringssl/crypto/x509/x_x509.c +67 -6
- data/third_party/boringssl/crypto/x509v3/pcy_cache.c +2 -2
- data/third_party/boringssl/crypto/x509v3/pcy_tree.c +2 -1
- data/third_party/boringssl/crypto/x509v3/v3_conf.c +4 -3
- data/third_party/boringssl/crypto/x509v3/v3_cpols.c +5 -0
- data/third_party/boringssl/crypto/x509v3/v3_prn.c +0 -3
- data/third_party/boringssl/crypto/x509v3/v3_purp.c +2 -2
- data/third_party/boringssl/crypto/x509v3/v3_utl.c +2 -1
- data/third_party/boringssl/include/openssl/aead.h +72 -73
- data/third_party/boringssl/include/openssl/arm_arch.h +0 -6
- data/third_party/boringssl/include/openssl/asn1.h +103 -235
- data/third_party/boringssl/include/openssl/asn1_mac.h +17 -74
- data/third_party/boringssl/include/openssl/asn1t.h +1 -11
- data/third_party/boringssl/include/openssl/base.h +145 -3
- data/third_party/boringssl/include/openssl/base64.h +20 -17
- data/third_party/boringssl/include/openssl/bio.h +59 -34
- data/third_party/boringssl/include/openssl/bn.h +118 -51
- data/third_party/boringssl/include/openssl/buf.h +15 -0
- data/third_party/boringssl/include/openssl/bytestring.h +52 -4
- data/third_party/boringssl/include/openssl/chacha.h +2 -2
- data/third_party/boringssl/include/openssl/cipher.h +18 -1
- data/third_party/boringssl/include/openssl/cmac.h +11 -0
- data/third_party/boringssl/include/openssl/conf.h +13 -2
- data/third_party/boringssl/include/openssl/cpu.h +20 -23
- data/third_party/boringssl/include/openssl/crypto.h +22 -1
- data/third_party/boringssl/include/openssl/curve25519.h +96 -4
- data/third_party/boringssl/include/openssl/dh.h +71 -16
- data/third_party/boringssl/include/openssl/digest.h +38 -11
- data/third_party/boringssl/include/openssl/dsa.h +40 -4
- data/third_party/boringssl/include/openssl/ec.h +44 -18
- data/third_party/boringssl/include/openssl/ec_key.h +27 -6
- data/third_party/boringssl/include/openssl/ecdsa.h +11 -0
- data/third_party/boringssl/include/openssl/engine.h +11 -0
- data/third_party/boringssl/include/openssl/evp.h +52 -88
- data/third_party/boringssl/include/openssl/hkdf.h +24 -4
- data/third_party/boringssl/include/openssl/hmac.h +20 -6
- data/third_party/boringssl/include/openssl/md4.h +4 -0
- data/third_party/boringssl/include/openssl/mem.h +19 -0
- data/third_party/boringssl/include/openssl/newhope.h +158 -0
- data/third_party/boringssl/include/openssl/nid.h +4166 -0
- data/third_party/boringssl/include/openssl/obj.h +31 -3
- data/third_party/boringssl/include/openssl/obj_mac.h +17 -4143
- data/third_party/boringssl/include/openssl/{opensslfeatures.h → opensslconf.h} +3 -3
- data/third_party/boringssl/include/openssl/pem.h +5 -0
- data/third_party/boringssl/include/openssl/pkcs8.h +12 -0
- data/third_party/boringssl/include/openssl/rand.h +6 -0
- data/third_party/boringssl/include/openssl/rc4.h +6 -0
- data/third_party/boringssl/{crypto/dh/internal.h → include/openssl/ripemd.h} +38 -11
- data/third_party/boringssl/include/openssl/rsa.h +127 -65
- data/third_party/boringssl/include/openssl/sha.h +14 -10
- data/third_party/boringssl/include/openssl/ssl.h +561 -275
- data/third_party/boringssl/include/openssl/ssl3.h +18 -25
- data/third_party/boringssl/include/openssl/stack.h +2 -4
- data/third_party/boringssl/include/openssl/stack_macros.h +321 -353
- data/third_party/boringssl/include/openssl/thread.h +31 -13
- data/third_party/boringssl/include/openssl/time_support.h +1 -0
- data/third_party/boringssl/include/openssl/tls1.h +37 -33
- data/third_party/boringssl/include/openssl/x509.h +69 -26
- data/third_party/boringssl/include/openssl/x509_vfy.h +12 -10
- data/third_party/boringssl/include/openssl/x509v3.h +23 -2
- data/third_party/boringssl/ssl/custom_extensions.c +3 -5
- data/third_party/boringssl/ssl/d1_both.c +463 -499
- data/third_party/boringssl/ssl/d1_lib.c +38 -109
- data/third_party/boringssl/ssl/d1_pkt.c +173 -334
- data/third_party/boringssl/ssl/d1_srtp.c +20 -18
- data/third_party/boringssl/ssl/{d1_meth.c → dtls_method.c} +88 -15
- data/third_party/boringssl/ssl/dtls_record.c +27 -26
- data/third_party/boringssl/ssl/{s3_clnt.c → handshake_client.c} +816 -904
- data/third_party/boringssl/ssl/handshake_server.c +1932 -0
- data/third_party/boringssl/ssl/internal.h +712 -439
- data/third_party/boringssl/ssl/s3_both.c +445 -257
- data/third_party/boringssl/ssl/s3_enc.c +53 -36
- data/third_party/boringssl/ssl/s3_lib.c +23 -268
- data/third_party/boringssl/ssl/s3_pkt.c +168 -364
- data/third_party/boringssl/ssl/ssl_aead_ctx.c +46 -17
- data/third_party/boringssl/ssl/ssl_asn1.c +56 -26
- data/third_party/boringssl/ssl/ssl_buffer.c +16 -24
- data/third_party/boringssl/ssl/ssl_cert.c +324 -49
- data/third_party/boringssl/ssl/ssl_cipher.c +205 -150
- data/third_party/boringssl/ssl/ssl_ecdh.c +287 -51
- data/third_party/boringssl/ssl/ssl_file.c +21 -68
- data/third_party/boringssl/ssl/ssl_lib.c +881 -510
- data/third_party/boringssl/ssl/ssl_rsa.c +404 -34
- data/third_party/boringssl/ssl/ssl_session.c +324 -103
- data/third_party/boringssl/ssl/ssl_stat.c +6 -88
- data/third_party/boringssl/ssl/t1_enc.c +23 -39
- data/third_party/boringssl/ssl/t1_lib.c +1120 -622
- data/third_party/boringssl/ssl/tls13_both.c +440 -0
- data/third_party/boringssl/ssl/tls13_client.c +682 -0
- data/third_party/boringssl/ssl/tls13_enc.c +391 -0
- data/third_party/boringssl/ssl/tls13_server.c +672 -0
- data/third_party/boringssl/ssl/{s3_meth.c → tls_method.c} +100 -21
- data/third_party/boringssl/ssl/tls_record.c +159 -77
- data/third_party/nanopb/pb.h +60 -28
- data/third_party/nanopb/pb_decode.c +120 -92
- data/third_party/nanopb/pb_decode.h +3 -3
- data/third_party/nanopb/pb_encode.c +73 -67
- data/third_party/nanopb/pb_encode.h +4 -4
- metadata +155 -89
- data/include/grpc/impl/codegen/byte_buffer.h +0 -122
- data/include/grpc/impl/codegen/log.h +0 -118
- data/include/grpc/impl/codegen/time.h +0 -130
- data/src/core/ext/client_config/client_channel.c +0 -593
- data/src/core/ext/client_config/subchannel_call_holder.c +0 -272
- data/src/core/ext/client_config/subchannel_call_holder.h +0 -99
- data/src/core/lib/iomgr/ev_poll_and_epoll_posix.c +0 -2046
- data/src/core/lib/iomgr/workqueue_posix.c +0 -151
- data/src/core/lib/security/transport/handshake.c +0 -368
- data/third_party/boringssl/crypto/asn1/a_bytes.c +0 -308
- data/third_party/boringssl/crypto/asn1/bio_asn1.c +0 -477
- data/third_party/boringssl/crypto/asn1/bio_ndef.c +0 -251
- data/third_party/boringssl/crypto/asn1/t_pkey.c +0 -110
- data/third_party/boringssl/crypto/asn1/tasn_prn.c +0 -596
- data/third_party/boringssl/crypto/chacha/chacha_vec.c +0 -328
- data/third_party/boringssl/crypto/directory.h +0 -66
- data/third_party/boringssl/crypto/directory_posix.c +0 -108
- data/third_party/boringssl/crypto/directory_win.c +0 -144
- data/third_party/boringssl/crypto/test/scoped_types.h +0 -140
- data/third_party/boringssl/include/openssl/pqueue.h +0 -146
- data/third_party/boringssl/ssl/d1_clnt.c +0 -561
- data/third_party/boringssl/ssl/d1_srvr.c +0 -476
- data/third_party/boringssl/ssl/pqueue/pqueue.c +0 -197
- data/third_party/boringssl/ssl/s3_srvr.c +0 -2272
- data/third_party/boringssl/ssl/test/async_bio.h +0 -45
- data/third_party/boringssl/ssl/test/packeted_bio.h +0 -44
- data/third_party/boringssl/ssl/test/test_config.h +0 -110
@@ -37,11 +37,12 @@
|
|
37
37
|
#include <grpc/byte_buffer.h>
|
38
38
|
#include <grpc/compression.h>
|
39
39
|
#include <grpc/grpc.h>
|
40
|
+
#include <grpc/slice_buffer.h>
|
40
41
|
#include <grpc/support/alloc.h>
|
41
42
|
#include <grpc/support/log.h>
|
42
|
-
#include <grpc/support/slice_buffer.h>
|
43
43
|
|
44
44
|
#include "src/core/lib/compression/message_compress.h"
|
45
|
+
#include "src/core/lib/slice/slice_internal.h"
|
45
46
|
|
46
47
|
static int is_compressed(grpc_byte_buffer *buffer) {
|
47
48
|
switch (buffer->type) {
|
@@ -56,13 +57,15 @@ static int is_compressed(grpc_byte_buffer *buffer) {
|
|
56
57
|
|
57
58
|
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
|
58
59
|
grpc_byte_buffer *buffer) {
|
59
|
-
|
60
|
+
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
61
|
+
grpc_slice_buffer decompressed_slices_buffer;
|
60
62
|
reader->buffer_in = buffer;
|
61
63
|
switch (reader->buffer_in->type) {
|
62
64
|
case GRPC_BB_RAW:
|
63
|
-
|
65
|
+
grpc_slice_buffer_init(&decompressed_slices_buffer);
|
64
66
|
if (is_compressed(reader->buffer_in)) {
|
65
|
-
if (grpc_msg_decompress(
|
67
|
+
if (grpc_msg_decompress(&exec_ctx,
|
68
|
+
reader->buffer_in->data.raw.compression,
|
66
69
|
&reader->buffer_in->data.raw.slice_buffer,
|
67
70
|
&decompressed_slices_buffer) == 0) {
|
68
71
|
gpr_log(GPR_ERROR,
|
@@ -76,13 +79,15 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
|
|
76
79
|
grpc_raw_byte_buffer_create(decompressed_slices_buffer.slices,
|
77
80
|
decompressed_slices_buffer.count);
|
78
81
|
}
|
79
|
-
|
82
|
+
grpc_slice_buffer_destroy_internal(&exec_ctx,
|
83
|
+
&decompressed_slices_buffer);
|
80
84
|
} else { /* not compressed, use the input buffer as output */
|
81
85
|
reader->buffer_out = reader->buffer_in;
|
82
86
|
}
|
83
87
|
reader->current.index = 0;
|
84
88
|
break;
|
85
89
|
}
|
90
|
+
grpc_exec_ctx_finish(&exec_ctx);
|
86
91
|
return 1;
|
87
92
|
}
|
88
93
|
|
@@ -98,13 +103,14 @@ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
|
|
98
103
|
}
|
99
104
|
|
100
105
|
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
|
101
|
-
|
106
|
+
grpc_slice *slice) {
|
102
107
|
switch (reader->buffer_in->type) {
|
103
108
|
case GRPC_BB_RAW: {
|
104
|
-
|
109
|
+
grpc_slice_buffer *slice_buffer;
|
105
110
|
slice_buffer = &reader->buffer_out->data.raw.slice_buffer;
|
106
111
|
if (reader->current.index < slice_buffer->count) {
|
107
|
-
*slice =
|
112
|
+
*slice = grpc_slice_ref_internal(
|
113
|
+
slice_buffer->slices[reader->current.index]);
|
108
114
|
reader->current.index += 1;
|
109
115
|
return 1;
|
110
116
|
}
|
@@ -114,19 +120,21 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
|
|
114
120
|
return 0;
|
115
121
|
}
|
116
122
|
|
117
|
-
|
118
|
-
|
123
|
+
grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) {
|
124
|
+
grpc_slice in_slice;
|
119
125
|
size_t bytes_read = 0;
|
120
126
|
const size_t input_size = grpc_byte_buffer_length(reader->buffer_out);
|
121
|
-
|
122
|
-
uint8_t *const outbuf =
|
127
|
+
grpc_slice out_slice = grpc_slice_malloc(input_size);
|
128
|
+
uint8_t *const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */
|
123
129
|
|
130
|
+
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
124
131
|
while (grpc_byte_buffer_reader_next(reader, &in_slice) != 0) {
|
125
|
-
const size_t slice_length =
|
126
|
-
memcpy(&(outbuf[bytes_read]),
|
132
|
+
const size_t slice_length = GRPC_SLICE_LENGTH(in_slice);
|
133
|
+
memcpy(&(outbuf[bytes_read]), GRPC_SLICE_START_PTR(in_slice), slice_length);
|
127
134
|
bytes_read += slice_length;
|
128
|
-
|
135
|
+
grpc_slice_unref_internal(&exec_ctx, in_slice);
|
129
136
|
GPR_ASSERT(bytes_read <= input_size);
|
130
137
|
}
|
138
|
+
grpc_exec_ctx_finish(&exec_ctx);
|
131
139
|
return out_slice;
|
132
140
|
}
|
data/src/core/lib/surface/call.c
CHANGED
@@ -30,6 +30,7 @@
|
|
30
30
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
31
|
*
|
32
32
|
*/
|
33
|
+
|
33
34
|
#include <assert.h>
|
34
35
|
#include <limits.h>
|
35
36
|
#include <stdio.h>
|
@@ -38,9 +39,9 @@
|
|
38
39
|
|
39
40
|
#include <grpc/compression.h>
|
40
41
|
#include <grpc/grpc.h>
|
42
|
+
#include <grpc/slice.h>
|
41
43
|
#include <grpc/support/alloc.h>
|
42
44
|
#include <grpc/support/log.h>
|
43
|
-
#include <grpc/support/slice.h>
|
44
45
|
#include <grpc/support/string_util.h>
|
45
46
|
#include <grpc/support/useful.h>
|
46
47
|
|
@@ -48,6 +49,8 @@
|
|
48
49
|
#include "src/core/lib/compression/algorithm_metadata.h"
|
49
50
|
#include "src/core/lib/iomgr/timer.h"
|
50
51
|
#include "src/core/lib/profiling/timers.h"
|
52
|
+
#include "src/core/lib/slice/slice_internal.h"
|
53
|
+
#include "src/core/lib/slice/slice_string_helpers.h"
|
51
54
|
#include "src/core/lib/support/string.h"
|
52
55
|
#include "src/core/lib/surface/api_trace.h"
|
53
56
|
#include "src/core/lib/surface/call.h"
|
@@ -109,6 +112,10 @@ typedef struct batch_control {
|
|
109
112
|
uint8_t recv_message;
|
110
113
|
uint8_t recv_final_op;
|
111
114
|
uint8_t is_notify_tag_closure;
|
115
|
+
|
116
|
+
/* TODO(ctiller): now that this is inlined, figure out how much of the above
|
117
|
+
state can be eliminated */
|
118
|
+
grpc_transport_stream_op op;
|
112
119
|
} batch_control;
|
113
120
|
|
114
121
|
struct grpc_call {
|
@@ -117,13 +124,12 @@ struct grpc_call {
|
|
117
124
|
grpc_channel *channel;
|
118
125
|
grpc_call *parent;
|
119
126
|
grpc_call *first_child;
|
127
|
+
gpr_timespec start_time;
|
120
128
|
/* TODO(ctiller): share with cq if possible? */
|
121
129
|
gpr_mu mu;
|
122
130
|
|
123
131
|
/* client or server call */
|
124
132
|
bool is_client;
|
125
|
-
/* is the alarm set */
|
126
|
-
bool have_alarm;
|
127
133
|
/** has grpc_call_destroy been called */
|
128
134
|
bool destroy_called;
|
129
135
|
/** flag indicating that cancellation is inherited */
|
@@ -154,8 +160,9 @@ struct grpc_call {
|
|
154
160
|
/* Received call statuses from various sources */
|
155
161
|
received_status status[STATUS_SOURCE_COUNT];
|
156
162
|
|
157
|
-
/* Call
|
158
|
-
|
163
|
+
/* Call data useful used for reporting. Only valid after the call has
|
164
|
+
* completed */
|
165
|
+
grpc_call_final_info final_info;
|
159
166
|
|
160
167
|
/* Compression algorithm for *incoming* data */
|
161
168
|
grpc_compression_algorithm incoming_compression_algorithm;
|
@@ -165,9 +172,6 @@ struct grpc_call {
|
|
165
172
|
/* Contexts for various subsystems (security, tracing, ...). */
|
166
173
|
grpc_call_context_element context[GRPC_CONTEXT_COUNT];
|
167
174
|
|
168
|
-
/* Deadline alarm - if have_alarm is non-zero */
|
169
|
-
grpc_timer alarm;
|
170
|
-
|
171
175
|
/* for the client, extra metadata is initial metadata; for the
|
172
176
|
server, it's trailing metadata */
|
173
177
|
grpc_linked_mdelem send_extra_metadata[MAX_SEND_EXTRA_METADATA_COUNT];
|
@@ -183,7 +187,7 @@ struct grpc_call {
|
|
183
187
|
grpc_slice_buffer_stream sending_stream;
|
184
188
|
grpc_byte_stream *receiving_stream;
|
185
189
|
grpc_byte_buffer **receiving_buffer;
|
186
|
-
|
190
|
+
grpc_slice receiving_slice;
|
187
191
|
grpc_closure receiving_slice_ready;
|
188
192
|
grpc_closure receiving_stream_ready;
|
189
193
|
grpc_closure receiving_initial_metadata_ready;
|
@@ -210,8 +214,6 @@ struct grpc_call {
|
|
210
214
|
#define CALL_FROM_TOP_ELEM(top_elem) \
|
211
215
|
CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem))
|
212
216
|
|
213
|
-
static void set_deadline_alarm(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
214
|
-
gpr_timespec deadline);
|
215
217
|
static void execute_op(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
216
218
|
grpc_transport_stream_op *op);
|
217
219
|
static grpc_call_error cancel_with_status(grpc_exec_ctx *exec_ctx, grpc_call *c,
|
@@ -225,33 +227,38 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call_stack,
|
|
225
227
|
static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
|
226
228
|
grpc_error *error);
|
227
229
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
const void *server_transport_data, grpc_mdelem **add_initial_metadata,
|
232
|
-
size_t add_initial_metadata_count, gpr_timespec send_deadline) {
|
230
|
+
grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx,
|
231
|
+
const grpc_call_create_args *args,
|
232
|
+
grpc_call **out_call) {
|
233
233
|
size_t i, j;
|
234
|
-
grpc_channel_stack *channel_stack =
|
235
|
-
|
234
|
+
grpc_channel_stack *channel_stack =
|
235
|
+
grpc_channel_get_channel_stack(args->channel);
|
236
236
|
grpc_call *call;
|
237
237
|
GPR_TIMER_BEGIN("grpc_call_create", 0);
|
238
238
|
call = gpr_malloc(sizeof(grpc_call) + channel_stack->call_stack_size);
|
239
|
+
*out_call = call;
|
239
240
|
memset(call, 0, sizeof(grpc_call));
|
240
241
|
gpr_mu_init(&call->mu);
|
241
|
-
call->channel = channel;
|
242
|
-
call->cq = cq;
|
243
|
-
call->parent = parent_call;
|
242
|
+
call->channel = args->channel;
|
243
|
+
call->cq = args->cq;
|
244
|
+
call->parent = args->parent_call;
|
245
|
+
call->start_time = gpr_now(GPR_CLOCK_MONOTONIC);
|
244
246
|
/* Always support no compression */
|
245
247
|
GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE);
|
246
|
-
call->is_client = server_transport_data == NULL;
|
248
|
+
call->is_client = args->server_transport_data == NULL;
|
249
|
+
grpc_mdstr *path = NULL;
|
247
250
|
if (call->is_client) {
|
248
|
-
GPR_ASSERT(add_initial_metadata_count <
|
249
|
-
|
250
|
-
|
251
|
+
GPR_ASSERT(args->add_initial_metadata_count <
|
252
|
+
MAX_SEND_EXTRA_METADATA_COUNT);
|
253
|
+
for (i = 0; i < args->add_initial_metadata_count; i++) {
|
254
|
+
call->send_extra_metadata[i].md = args->add_initial_metadata[i];
|
255
|
+
if (args->add_initial_metadata[i]->key == GRPC_MDSTR_PATH) {
|
256
|
+
path = GRPC_MDSTR_REF(args->add_initial_metadata[i]->value);
|
257
|
+
}
|
251
258
|
}
|
252
|
-
call->send_extra_metadata_count = (int)add_initial_metadata_count;
|
259
|
+
call->send_extra_metadata_count = (int)args->add_initial_metadata_count;
|
253
260
|
} else {
|
254
|
-
GPR_ASSERT(add_initial_metadata_count == 0);
|
261
|
+
GPR_ASSERT(args->add_initial_metadata_count == 0);
|
255
262
|
call->send_extra_metadata_count = 0;
|
256
263
|
}
|
257
264
|
for (i = 0; i < 2; i++) {
|
@@ -259,77 +266,86 @@ grpc_call *grpc_call_create(
|
|
259
266
|
call->metadata_batch[i][j].deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
|
260
267
|
}
|
261
268
|
}
|
262
|
-
|
263
|
-
gpr_convert_clock_type(send_deadline, GPR_CLOCK_MONOTONIC);
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
call->context, server_transport_data,
|
268
|
-
CALL_STACK_FROM_CALL(call));
|
269
|
-
if (cq != NULL) {
|
270
|
-
GPR_ASSERT(
|
271
|
-
pollset_set_alternative == NULL &&
|
272
|
-
"Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
|
273
|
-
GRPC_CQ_INTERNAL_REF(cq, "bind");
|
274
|
-
call->pollent =
|
275
|
-
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(cq));
|
276
|
-
}
|
277
|
-
if (pollset_set_alternative != NULL) {
|
278
|
-
call->pollent =
|
279
|
-
grpc_polling_entity_create_from_pollset_set(pollset_set_alternative);
|
280
|
-
}
|
281
|
-
if (!grpc_polling_entity_is_empty(&call->pollent)) {
|
282
|
-
grpc_call_stack_set_pollset_or_pollset_set(
|
283
|
-
&exec_ctx, CALL_STACK_FROM_CALL(call), &call->pollent);
|
284
|
-
}
|
285
|
-
if (parent_call != NULL) {
|
286
|
-
GRPC_CALL_INTERNAL_REF(parent_call, "child");
|
269
|
+
gpr_timespec send_deadline =
|
270
|
+
gpr_convert_clock_type(args->send_deadline, GPR_CLOCK_MONOTONIC);
|
271
|
+
|
272
|
+
if (args->parent_call != NULL) {
|
273
|
+
GRPC_CALL_INTERNAL_REF(args->parent_call, "child");
|
287
274
|
GPR_ASSERT(call->is_client);
|
288
|
-
GPR_ASSERT(!parent_call->is_client);
|
275
|
+
GPR_ASSERT(!args->parent_call->is_client);
|
289
276
|
|
290
|
-
gpr_mu_lock(&parent_call->mu);
|
277
|
+
gpr_mu_lock(&args->parent_call->mu);
|
291
278
|
|
292
|
-
if (propagation_mask & GRPC_PROPAGATE_DEADLINE) {
|
279
|
+
if (args->propagation_mask & GRPC_PROPAGATE_DEADLINE) {
|
293
280
|
send_deadline = gpr_time_min(
|
294
281
|
gpr_convert_clock_type(send_deadline,
|
295
|
-
parent_call->send_deadline.clock_type),
|
296
|
-
parent_call->send_deadline);
|
282
|
+
args->parent_call->send_deadline.clock_type),
|
283
|
+
args->parent_call->send_deadline);
|
297
284
|
}
|
298
285
|
/* for now GRPC_PROPAGATE_TRACING_CONTEXT *MUST* be passed with
|
299
286
|
* GRPC_PROPAGATE_STATS_CONTEXT */
|
300
287
|
/* TODO(ctiller): This should change to use the appropriate census start_op
|
301
288
|
* call. */
|
302
|
-
if (propagation_mask & GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT) {
|
303
|
-
GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT);
|
304
|
-
grpc_call_context_set(
|
305
|
-
|
306
|
-
|
289
|
+
if (args->propagation_mask & GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT) {
|
290
|
+
GPR_ASSERT(args->propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT);
|
291
|
+
grpc_call_context_set(
|
292
|
+
call, GRPC_CONTEXT_TRACING,
|
293
|
+
args->parent_call->context[GRPC_CONTEXT_TRACING].value, NULL);
|
307
294
|
} else {
|
308
|
-
GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT);
|
295
|
+
GPR_ASSERT(args->propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT);
|
309
296
|
}
|
310
|
-
if (propagation_mask & GRPC_PROPAGATE_CANCELLATION) {
|
297
|
+
if (args->propagation_mask & GRPC_PROPAGATE_CANCELLATION) {
|
311
298
|
call->cancellation_is_inherited = 1;
|
312
299
|
}
|
313
300
|
|
314
|
-
if (parent_call->first_child == NULL) {
|
315
|
-
parent_call->first_child = call;
|
301
|
+
if (args->parent_call->first_child == NULL) {
|
302
|
+
args->parent_call->first_child = call;
|
316
303
|
call->sibling_next = call->sibling_prev = call;
|
317
304
|
} else {
|
318
|
-
call->sibling_next = parent_call->first_child;
|
319
|
-
call->sibling_prev = parent_call->first_child->sibling_prev;
|
305
|
+
call->sibling_next = args->parent_call->first_child;
|
306
|
+
call->sibling_prev = args->parent_call->first_child->sibling_prev;
|
320
307
|
call->sibling_next->sibling_prev = call->sibling_prev->sibling_next =
|
321
308
|
call;
|
322
309
|
}
|
323
310
|
|
324
|
-
gpr_mu_unlock(&parent_call->mu);
|
311
|
+
gpr_mu_unlock(&args->parent_call->mu);
|
325
312
|
}
|
326
|
-
|
327
|
-
|
328
|
-
|
313
|
+
|
314
|
+
call->send_deadline = send_deadline;
|
315
|
+
|
316
|
+
GRPC_CHANNEL_INTERNAL_REF(args->channel, "call");
|
317
|
+
/* initial refcount dropped by grpc_call_destroy */
|
318
|
+
grpc_error *error = grpc_call_stack_init(
|
319
|
+
exec_ctx, channel_stack, 1, destroy_call, call, call->context,
|
320
|
+
args->server_transport_data, path, call->start_time, send_deadline,
|
321
|
+
CALL_STACK_FROM_CALL(call));
|
322
|
+
if (error != GRPC_ERROR_NONE) {
|
323
|
+
grpc_status_code status;
|
324
|
+
const char *error_str;
|
325
|
+
grpc_error_get_status(error, &status, &error_str);
|
326
|
+
close_with_status(exec_ctx, call, status, error_str);
|
329
327
|
}
|
330
|
-
|
328
|
+
if (args->cq != NULL) {
|
329
|
+
GPR_ASSERT(
|
330
|
+
args->pollset_set_alternative == NULL &&
|
331
|
+
"Only one of 'cq' and 'pollset_set_alternative' should be non-NULL.");
|
332
|
+
GRPC_CQ_INTERNAL_REF(args->cq, "bind");
|
333
|
+
call->pollent =
|
334
|
+
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(args->cq));
|
335
|
+
}
|
336
|
+
if (args->pollset_set_alternative != NULL) {
|
337
|
+
call->pollent = grpc_polling_entity_create_from_pollset_set(
|
338
|
+
args->pollset_set_alternative);
|
339
|
+
}
|
340
|
+
if (!grpc_polling_entity_is_empty(&call->pollent)) {
|
341
|
+
grpc_call_stack_set_pollset_or_pollset_set(
|
342
|
+
exec_ctx, CALL_STACK_FROM_CALL(call), &call->pollent);
|
343
|
+
}
|
344
|
+
|
345
|
+
if (path != NULL) GRPC_MDSTR_UNREF(exec_ctx, path);
|
346
|
+
|
331
347
|
GPR_TIMER_END("grpc_call_create", 0);
|
332
|
-
return
|
348
|
+
return error;
|
333
349
|
}
|
334
350
|
|
335
351
|
void grpc_call_set_completion_queue(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
@@ -361,6 +377,25 @@ void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *c REF_ARG) {
|
|
361
377
|
GRPC_CALL_STACK_UNREF(exec_ctx, CALL_STACK_FROM_CALL(c), REF_REASON);
|
362
378
|
}
|
363
379
|
|
380
|
+
static void get_final_status(grpc_call *call,
|
381
|
+
void (*set_value)(grpc_status_code code,
|
382
|
+
void *user_data),
|
383
|
+
void *set_value_user_data) {
|
384
|
+
int i;
|
385
|
+
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
386
|
+
if (call->status[i].is_set) {
|
387
|
+
set_value(call->status[i].code, set_value_user_data);
|
388
|
+
return;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
if (call->is_client) {
|
392
|
+
set_value(GRPC_STATUS_UNKNOWN, set_value_user_data);
|
393
|
+
} else {
|
394
|
+
set_value(GRPC_STATUS_OK, set_value_user_data);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
static void set_status_value_directly(grpc_status_code status, void *dest);
|
364
399
|
static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
365
400
|
grpc_error *error) {
|
366
401
|
size_t i;
|
@@ -369,7 +404,7 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
|
369
404
|
GPR_TIMER_BEGIN("destroy_call", 0);
|
370
405
|
for (i = 0; i < 2; i++) {
|
371
406
|
grpc_metadata_batch_destroy(
|
372
|
-
&c->metadata_batch[1 /* is_receiving */][i /* is_initial */]);
|
407
|
+
exec_ctx, &c->metadata_batch[1 /* is_receiving */][i /* is_initial */]);
|
373
408
|
}
|
374
409
|
if (c->receiving_stream != NULL) {
|
375
410
|
grpc_byte_stream_destroy(exec_ctx, c->receiving_stream);
|
@@ -377,11 +412,11 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
|
377
412
|
gpr_mu_destroy(&c->mu);
|
378
413
|
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
379
414
|
if (c->status[i].details) {
|
380
|
-
GRPC_MDSTR_UNREF(c->status[i].details);
|
415
|
+
GRPC_MDSTR_UNREF(exec_ctx, c->status[i].details);
|
381
416
|
}
|
382
417
|
}
|
383
418
|
for (ii = 0; ii < c->send_extra_metadata_count; ii++) {
|
384
|
-
GRPC_MDELEM_UNREF(c->send_extra_metadata[ii].md);
|
419
|
+
GRPC_MDELEM_UNREF(exec_ctx, c->send_extra_metadata[ii].md);
|
385
420
|
}
|
386
421
|
for (i = 0; i < GRPC_CONTEXT_COUNT; i++) {
|
387
422
|
if (c->context[i].destroy) {
|
@@ -392,7 +427,13 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
|
392
427
|
GRPC_CQ_INTERNAL_UNREF(c->cq, "bind");
|
393
428
|
}
|
394
429
|
grpc_channel *channel = c->channel;
|
395
|
-
|
430
|
+
|
431
|
+
get_final_status(call, set_status_value_directly,
|
432
|
+
&c->final_info.final_status);
|
433
|
+
c->final_info.stats.latency =
|
434
|
+
gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), c->start_time);
|
435
|
+
|
436
|
+
grpc_call_stack_destroy(exec_ctx, CALL_STACK_FROM_CALL(c), &c->final_info, c);
|
396
437
|
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, "call");
|
397
438
|
GPR_TIMER_END("destroy_call", 0);
|
398
439
|
}
|
@@ -405,49 +446,22 @@ static void set_status_code(grpc_call *call, status_source source,
|
|
405
446
|
call->status[source].code = (grpc_status_code)status;
|
406
447
|
}
|
407
448
|
|
408
|
-
static void set_status_details(
|
409
|
-
grpc_mdstr *status) {
|
449
|
+
static void set_status_details(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
450
|
+
status_source source, grpc_mdstr *status) {
|
410
451
|
if (call->status[source].details != NULL) {
|
411
|
-
GRPC_MDSTR_UNREF(status);
|
452
|
+
GRPC_MDSTR_UNREF(exec_ctx, status);
|
412
453
|
} else {
|
413
454
|
call->status[source].details = status;
|
414
455
|
}
|
415
456
|
}
|
416
457
|
|
417
|
-
static void
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
set_value(call->status[i].code, set_value_user_data);
|
425
|
-
return;
|
426
|
-
}
|
427
|
-
}
|
428
|
-
if (call->is_client) {
|
429
|
-
set_value(GRPC_STATUS_UNKNOWN, set_value_user_data);
|
430
|
-
} else {
|
431
|
-
set_value(GRPC_STATUS_OK, set_value_user_data);
|
432
|
-
}
|
433
|
-
}
|
434
|
-
|
435
|
-
static void set_status_from_error(grpc_call *call, status_source source,
|
436
|
-
grpc_error *error) {
|
437
|
-
intptr_t status;
|
438
|
-
if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &status)) {
|
439
|
-
set_status_code(call, source, (uint32_t)status);
|
440
|
-
} else {
|
441
|
-
set_status_code(call, source, GRPC_STATUS_INTERNAL);
|
442
|
-
}
|
443
|
-
const char *msg = grpc_error_get_str(error, GRPC_ERROR_STR_GRPC_MESSAGE);
|
444
|
-
bool free_msg = false;
|
445
|
-
if (msg == NULL) {
|
446
|
-
free_msg = true;
|
447
|
-
msg = grpc_error_string(error);
|
448
|
-
}
|
449
|
-
set_status_details(call, source, grpc_mdstr_from_string(msg));
|
450
|
-
if (free_msg) grpc_error_free_string(msg);
|
458
|
+
static void set_status_from_error(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
459
|
+
status_source source, grpc_error *error) {
|
460
|
+
grpc_status_code status;
|
461
|
+
const char *msg;
|
462
|
+
grpc_error_get_status(error, &status, &msg);
|
463
|
+
set_status_code(call, source, (uint32_t)status);
|
464
|
+
set_status_details(exec_ctx, call, source, grpc_mdstr_from_string(msg));
|
451
465
|
}
|
452
466
|
|
453
467
|
static void set_incoming_compression_algorithm(
|
@@ -481,11 +495,12 @@ uint32_t grpc_call_test_only_get_message_flags(grpc_call *call) {
|
|
481
495
|
|
482
496
|
static void destroy_encodings_accepted_by_peer(void *p) { return; }
|
483
497
|
|
484
|
-
static void set_encodings_accepted_by_peer(
|
498
|
+
static void set_encodings_accepted_by_peer(grpc_exec_ctx *exec_ctx,
|
499
|
+
grpc_call *call, grpc_mdelem *mdel) {
|
485
500
|
size_t i;
|
486
501
|
grpc_compression_algorithm algorithm;
|
487
|
-
|
488
|
-
|
502
|
+
grpc_slice_buffer accept_encoding_parts;
|
503
|
+
grpc_slice accept_encoding_slice;
|
489
504
|
void *accepted_user_data;
|
490
505
|
|
491
506
|
accepted_user_data =
|
@@ -497,23 +512,23 @@ static void set_encodings_accepted_by_peer(grpc_call *call, grpc_mdelem *mdel) {
|
|
497
512
|
}
|
498
513
|
|
499
514
|
accept_encoding_slice = mdel->value->slice;
|
500
|
-
|
501
|
-
|
515
|
+
grpc_slice_buffer_init(&accept_encoding_parts);
|
516
|
+
grpc_slice_split(accept_encoding_slice, ",", &accept_encoding_parts);
|
502
517
|
|
503
518
|
/* No need to zero call->encodings_accepted_by_peer: grpc_call_create already
|
504
519
|
* zeroes the whole grpc_call */
|
505
520
|
/* Always support no compression */
|
506
521
|
GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE);
|
507
522
|
for (i = 0; i < accept_encoding_parts.count; i++) {
|
508
|
-
const
|
523
|
+
const grpc_slice *accept_encoding_entry_slice =
|
509
524
|
&accept_encoding_parts.slices[i];
|
510
525
|
if (grpc_compression_algorithm_parse(
|
511
|
-
(const char *)
|
512
|
-
|
526
|
+
(const char *)GRPC_SLICE_START_PTR(*accept_encoding_entry_slice),
|
527
|
+
GRPC_SLICE_LENGTH(*accept_encoding_entry_slice), &algorithm)) {
|
513
528
|
GPR_BITSET(&call->encodings_accepted_by_peer, algorithm);
|
514
529
|
} else {
|
515
530
|
char *accept_encoding_entry_str =
|
516
|
-
|
531
|
+
grpc_dump_slice(*accept_encoding_entry_slice, GPR_DUMP_ASCII);
|
517
532
|
gpr_log(GPR_ERROR,
|
518
533
|
"Invalid entry in accept encoding metadata: '%s'. Ignoring.",
|
519
534
|
accept_encoding_entry_str);
|
@@ -521,7 +536,7 @@ static void set_encodings_accepted_by_peer(grpc_call *call, grpc_mdelem *mdel) {
|
|
521
536
|
}
|
522
537
|
}
|
523
538
|
|
524
|
-
|
539
|
+
grpc_slice_buffer_destroy_internal(exec_ctx, &accept_encoding_parts);
|
525
540
|
|
526
541
|
grpc_mdelem_set_user_data(
|
527
542
|
mdel, destroy_encodings_accepted_by_peer,
|
@@ -542,14 +557,14 @@ static void get_final_details(grpc_call *call, char **out_details,
|
|
542
557
|
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
543
558
|
if (call->status[i].is_set) {
|
544
559
|
if (call->status[i].details) {
|
545
|
-
|
546
|
-
size_t len =
|
560
|
+
grpc_slice details = call->status[i].details->slice;
|
561
|
+
size_t len = GRPC_SLICE_LENGTH(details);
|
547
562
|
if (len + 1 > *out_details_capacity) {
|
548
563
|
*out_details_capacity =
|
549
564
|
GPR_MAX(len + 1, *out_details_capacity * 3 / 2);
|
550
565
|
*out_details = gpr_realloc(*out_details, *out_details_capacity);
|
551
566
|
}
|
552
|
-
memcpy(*out_details,
|
567
|
+
memcpy(*out_details, GRPC_SLICE_START_PTR(details), len);
|
553
568
|
(*out_details)[len] = 0;
|
554
569
|
} else {
|
555
570
|
goto no_details;
|
@@ -579,12 +594,10 @@ static grpc_metadata *get_md_elem(grpc_metadata *metadata,
|
|
579
594
|
return res;
|
580
595
|
}
|
581
596
|
|
582
|
-
static int prepare_application_metadata(
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
grpc_metadata *additional_metadata,
|
587
|
-
int additional_metadata_count) {
|
597
|
+
static int prepare_application_metadata(
|
598
|
+
grpc_exec_ctx *exec_ctx, grpc_call *call, int count,
|
599
|
+
grpc_metadata *metadata, int is_trailing, int prepend_extra_metadata,
|
600
|
+
grpc_metadata *additional_metadata, int additional_metadata_count) {
|
588
601
|
int total_count = count + additional_metadata_count;
|
589
602
|
int i;
|
590
603
|
grpc_metadata_batch *batch =
|
@@ -595,7 +608,7 @@ static int prepare_application_metadata(grpc_call *call, int count,
|
|
595
608
|
grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data;
|
596
609
|
GPR_ASSERT(sizeof(grpc_linked_mdelem) == sizeof(md->internal_data));
|
597
610
|
l->md = grpc_mdelem_from_string_and_buffer(
|
598
|
-
md->key, (const uint8_t *)md->value, md->value_length);
|
611
|
+
exec_ctx, md->key, (const uint8_t *)md->value, md->value_length);
|
599
612
|
if (!grpc_header_key_is_legal(grpc_mdstr_as_c_string(l->md->key),
|
600
613
|
GRPC_MDSTR_LENGTH(l->md->key))) {
|
601
614
|
gpr_log(GPR_ERROR, "attempt to send invalid metadata key: %s",
|
@@ -615,7 +628,7 @@ static int prepare_application_metadata(grpc_call *call, int count,
|
|
615
628
|
const grpc_metadata *md =
|
616
629
|
get_md_elem(metadata, additional_metadata, j, count);
|
617
630
|
grpc_linked_mdelem *l = (grpc_linked_mdelem *)&md->internal_data;
|
618
|
-
GRPC_MDELEM_UNREF(l->md);
|
631
|
+
GRPC_MDELEM_UNREF(exec_ctx, l->md);
|
619
632
|
}
|
620
633
|
return 0;
|
621
634
|
}
|
@@ -623,9 +636,6 @@ static int prepare_application_metadata(grpc_call *call, int count,
|
|
623
636
|
if (call->send_extra_metadata_count == 0) {
|
624
637
|
prepend_extra_metadata = 0;
|
625
638
|
} else {
|
626
|
-
for (i = 0; i < call->send_extra_metadata_count; i++) {
|
627
|
-
GRPC_MDELEM_REF(call->send_extra_metadata[i].md);
|
628
|
-
}
|
629
639
|
for (i = 1; i < call->send_extra_metadata_count; i++) {
|
630
640
|
call->send_extra_metadata[i].prev = &call->send_extra_metadata[i - 1];
|
631
641
|
}
|
@@ -671,6 +681,7 @@ static int prepare_application_metadata(grpc_call *call, int count,
|
|
671
681
|
&call->send_extra_metadata[call->send_extra_metadata_count - 1];
|
672
682
|
batch->list.head->prev = NULL;
|
673
683
|
batch->list.tail->next = NULL;
|
684
|
+
call->send_extra_metadata_count = 0;
|
674
685
|
break;
|
675
686
|
case 3: {
|
676
687
|
/* prepend AND md */
|
@@ -686,6 +697,7 @@ static int prepare_application_metadata(grpc_call *call, int count,
|
|
686
697
|
batch->list.tail = linked_from_md(last_md);
|
687
698
|
batch->list.head->prev = NULL;
|
688
699
|
batch->list.tail->next = NULL;
|
700
|
+
call->send_extra_metadata_count = 0;
|
689
701
|
break;
|
690
702
|
}
|
691
703
|
default:
|
@@ -720,9 +732,6 @@ void grpc_call_destroy(grpc_call *c) {
|
|
720
732
|
gpr_mu_lock(&c->mu);
|
721
733
|
GPR_ASSERT(!c->destroy_called);
|
722
734
|
c->destroy_called = 1;
|
723
|
-
if (c->have_alarm) {
|
724
|
-
grpc_timer_cancel(&exec_ctx, &c->alarm);
|
725
|
-
}
|
726
735
|
cancel = !c->received_final_op;
|
727
736
|
gpr_mu_unlock(&c->mu);
|
728
737
|
if (cancel) grpc_call_cancel(c, NULL);
|
@@ -760,8 +769,8 @@ typedef struct termination_closure {
|
|
760
769
|
grpc_closure closure;
|
761
770
|
grpc_call *call;
|
762
771
|
grpc_error *error;
|
763
|
-
grpc_closure *op_closure;
|
764
772
|
enum { TC_CANCEL, TC_CLOSE } type;
|
773
|
+
grpc_transport_stream_op op;
|
765
774
|
} termination_closure;
|
766
775
|
|
767
776
|
static void done_termination(grpc_exec_ctx *exec_ctx, void *tcp,
|
@@ -776,45 +785,44 @@ static void done_termination(grpc_exec_ctx *exec_ctx, void *tcp,
|
|
776
785
|
break;
|
777
786
|
}
|
778
787
|
GRPC_ERROR_UNREF(tc->error);
|
779
|
-
grpc_exec_ctx_sched(exec_ctx, tc->op_closure, GRPC_ERROR_NONE, NULL);
|
780
788
|
gpr_free(tc);
|
781
789
|
}
|
782
790
|
|
783
791
|
static void send_cancel(grpc_exec_ctx *exec_ctx, void *tcp, grpc_error *error) {
|
784
|
-
grpc_transport_stream_op op;
|
785
792
|
termination_closure *tc = tcp;
|
786
|
-
memset(&op, 0, sizeof(op));
|
787
|
-
op.cancel_error = tc->error;
|
793
|
+
memset(&tc->op, 0, sizeof(tc->op));
|
794
|
+
tc->op.cancel_error = tc->error;
|
788
795
|
/* reuse closure to catch completion */
|
789
|
-
grpc_closure_init(&tc->closure, done_termination, tc
|
790
|
-
|
791
|
-
|
796
|
+
grpc_closure_init(&tc->closure, done_termination, tc,
|
797
|
+
grpc_schedule_on_exec_ctx);
|
798
|
+
tc->op.on_complete = &tc->closure;
|
799
|
+
execute_op(exec_ctx, tc->call, &tc->op);
|
792
800
|
}
|
793
801
|
|
794
802
|
static void send_close(grpc_exec_ctx *exec_ctx, void *tcp, grpc_error *error) {
|
795
|
-
grpc_transport_stream_op op;
|
796
803
|
termination_closure *tc = tcp;
|
797
|
-
memset(&op, 0, sizeof(op));
|
798
|
-
op.close_error = tc->error;
|
804
|
+
memset(&tc->op, 0, sizeof(tc->op));
|
805
|
+
tc->op.close_error = tc->error;
|
799
806
|
/* reuse closure to catch completion */
|
800
|
-
grpc_closure_init(&tc->closure, done_termination, tc
|
801
|
-
|
802
|
-
op.on_complete = &tc->closure;
|
803
|
-
execute_op(exec_ctx, tc->call, &op);
|
807
|
+
grpc_closure_init(&tc->closure, done_termination, tc,
|
808
|
+
grpc_schedule_on_exec_ctx);
|
809
|
+
tc->op.on_complete = &tc->closure;
|
810
|
+
execute_op(exec_ctx, tc->call, &tc->op);
|
804
811
|
}
|
805
812
|
|
806
813
|
static grpc_call_error terminate_with_status(grpc_exec_ctx *exec_ctx,
|
807
814
|
termination_closure *tc) {
|
808
|
-
set_status_from_error(tc->call, STATUS_FROM_API_OVERRIDE,
|
815
|
+
set_status_from_error(exec_ctx, tc->call, STATUS_FROM_API_OVERRIDE,
|
816
|
+
tc->error);
|
809
817
|
|
810
818
|
if (tc->type == TC_CANCEL) {
|
811
|
-
grpc_closure_init(&tc->closure, send_cancel, tc);
|
819
|
+
grpc_closure_init(&tc->closure, send_cancel, tc, grpc_schedule_on_exec_ctx);
|
812
820
|
GRPC_CALL_INTERNAL_REF(tc->call, "cancel");
|
813
821
|
} else if (tc->type == TC_CLOSE) {
|
814
|
-
grpc_closure_init(&tc->closure, send_close, tc);
|
822
|
+
grpc_closure_init(&tc->closure, send_close, tc, grpc_schedule_on_exec_ctx);
|
815
823
|
GRPC_CALL_INTERNAL_REF(tc->call, "close");
|
816
824
|
}
|
817
|
-
|
825
|
+
grpc_closure_sched(exec_ctx, &tc->closure, GRPC_ERROR_NONE);
|
818
826
|
return GRPC_CALL_OK;
|
819
827
|
}
|
820
828
|
|
@@ -881,32 +889,6 @@ grpc_call *grpc_call_from_top_element(grpc_call_element *elem) {
|
|
881
889
|
return CALL_FROM_TOP_ELEM(elem);
|
882
890
|
}
|
883
891
|
|
884
|
-
static void call_alarm(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
885
|
-
grpc_call *call = arg;
|
886
|
-
gpr_mu_lock(&call->mu);
|
887
|
-
call->have_alarm = 0;
|
888
|
-
if (error != GRPC_ERROR_CANCELLED) {
|
889
|
-
cancel_with_status(exec_ctx, call, GRPC_STATUS_DEADLINE_EXCEEDED,
|
890
|
-
"Deadline Exceeded");
|
891
|
-
}
|
892
|
-
gpr_mu_unlock(&call->mu);
|
893
|
-
GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "alarm");
|
894
|
-
}
|
895
|
-
|
896
|
-
static void set_deadline_alarm(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
897
|
-
gpr_timespec deadline) {
|
898
|
-
if (call->have_alarm) {
|
899
|
-
gpr_log(GPR_ERROR, "Attempt to set deadline alarm twice");
|
900
|
-
assert(0);
|
901
|
-
return;
|
902
|
-
}
|
903
|
-
GRPC_CALL_INTERNAL_REF(call, "alarm");
|
904
|
-
call->have_alarm = 1;
|
905
|
-
call->send_deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
|
906
|
-
grpc_timer_init(exec_ctx, &call->alarm, call->send_deadline, call_alarm, call,
|
907
|
-
gpr_now(GPR_CLOCK_MONOTONIC));
|
908
|
-
}
|
909
|
-
|
910
892
|
/* we offset status by a small amount when storing it into transport metadata
|
911
893
|
as metadata cannot store a 0 value (which is used as OK for grpc_status_codes
|
912
894
|
*/
|
@@ -924,7 +906,7 @@ static uint32_t decode_status(grpc_mdelem *md) {
|
|
924
906
|
status = ((uint32_t)(intptr_t)user_data) - STATUS_OFFSET;
|
925
907
|
} else {
|
926
908
|
if (!gpr_parse_bytes_to_uint32(grpc_mdstr_as_c_string(md->value),
|
927
|
-
|
909
|
+
GRPC_SLICE_LENGTH(md->value->slice),
|
928
910
|
&status)) {
|
929
911
|
status = GRPC_STATUS_UNKNOWN; /* could not parse status code */
|
930
912
|
}
|
@@ -948,7 +930,8 @@ static grpc_compression_algorithm decode_compression(grpc_mdelem *md) {
|
|
948
930
|
return algorithm;
|
949
931
|
}
|
950
932
|
|
951
|
-
static grpc_mdelem *recv_common_filter(
|
933
|
+
static grpc_mdelem *recv_common_filter(grpc_exec_ctx *exec_ctx, grpc_call *call,
|
934
|
+
grpc_mdelem *elem) {
|
952
935
|
if (elem->key == GRPC_MDSTR_GRPC_STATUS) {
|
953
936
|
GPR_TIMER_BEGIN("status", 0);
|
954
937
|
set_status_code(call, STATUS_FROM_WIRE, decode_status(elem));
|
@@ -956,7 +939,8 @@ static grpc_mdelem *recv_common_filter(grpc_call *call, grpc_mdelem *elem) {
|
|
956
939
|
return NULL;
|
957
940
|
} else if (elem->key == GRPC_MDSTR_GRPC_MESSAGE) {
|
958
941
|
GPR_TIMER_BEGIN("status-details", 0);
|
959
|
-
set_status_details(call, STATUS_FROM_WIRE,
|
942
|
+
set_status_details(exec_ctx, call, STATUS_FROM_WIRE,
|
943
|
+
GRPC_MDSTR_REF(elem->value));
|
960
944
|
GPR_TIMER_END("status-details", 0);
|
961
945
|
return NULL;
|
962
946
|
}
|
@@ -977,14 +961,15 @@ static grpc_mdelem *publish_app_metadata(grpc_call *call, grpc_mdelem *elem,
|
|
977
961
|
mdusr = &dest->metadata[dest->count++];
|
978
962
|
mdusr->key = grpc_mdstr_as_c_string(elem->key);
|
979
963
|
mdusr->value = grpc_mdstr_as_c_string(elem->value);
|
980
|
-
mdusr->value_length =
|
964
|
+
mdusr->value_length = GRPC_SLICE_LENGTH(elem->value->slice);
|
981
965
|
GPR_TIMER_END("publish_app_metadata", 0);
|
982
966
|
return elem;
|
983
967
|
}
|
984
968
|
|
985
|
-
static grpc_mdelem *recv_initial_filter(
|
986
|
-
|
987
|
-
|
969
|
+
static grpc_mdelem *recv_initial_filter(grpc_exec_ctx *exec_ctx, void *args,
|
970
|
+
grpc_mdelem *elem) {
|
971
|
+
grpc_call *call = args;
|
972
|
+
elem = recv_common_filter(exec_ctx, call, elem);
|
988
973
|
if (elem == NULL) {
|
989
974
|
return NULL;
|
990
975
|
} else if (elem->key == GRPC_MDSTR_GRPC_ENCODING) {
|
@@ -994,7 +979,7 @@ static grpc_mdelem *recv_initial_filter(void *callp, grpc_mdelem *elem) {
|
|
994
979
|
return NULL;
|
995
980
|
} else if (elem->key == GRPC_MDSTR_GRPC_ACCEPT_ENCODING) {
|
996
981
|
GPR_TIMER_BEGIN("encodings_accepted_by_peer", 0);
|
997
|
-
set_encodings_accepted_by_peer(call, elem);
|
982
|
+
set_encodings_accepted_by_peer(exec_ctx, call, elem);
|
998
983
|
GPR_TIMER_END("encodings_accepted_by_peer", 0);
|
999
984
|
return NULL;
|
1000
985
|
} else {
|
@@ -1002,9 +987,10 @@ static grpc_mdelem *recv_initial_filter(void *callp, grpc_mdelem *elem) {
|
|
1002
987
|
}
|
1003
988
|
}
|
1004
989
|
|
1005
|
-
static grpc_mdelem *recv_trailing_filter(
|
1006
|
-
|
1007
|
-
|
990
|
+
static grpc_mdelem *recv_trailing_filter(grpc_exec_ctx *exec_ctx, void *args,
|
991
|
+
grpc_mdelem *elem) {
|
992
|
+
grpc_call *call = args;
|
993
|
+
elem = recv_common_filter(exec_ctx, call, elem);
|
1008
994
|
if (elem == NULL) {
|
1009
995
|
return NULL;
|
1010
996
|
} else {
|
@@ -1070,9 +1056,14 @@ static void finish_batch_completion(grpc_exec_ctx *exec_ctx, void *user_data,
|
|
1070
1056
|
static void post_batch_completion(grpc_exec_ctx *exec_ctx,
|
1071
1057
|
batch_control *bctl) {
|
1072
1058
|
grpc_call *call = bctl->call;
|
1059
|
+
grpc_error *error = bctl->error;
|
1060
|
+
if (bctl->recv_final_op) {
|
1061
|
+
GRPC_ERROR_UNREF(error);
|
1062
|
+
error = GRPC_ERROR_NONE;
|
1063
|
+
}
|
1073
1064
|
if (bctl->is_notify_tag_closure) {
|
1074
1065
|
/* unrefs bctl->error */
|
1075
|
-
|
1066
|
+
grpc_closure_run(exec_ctx, bctl->notify_tag, error);
|
1076
1067
|
gpr_mu_lock(&call->mu);
|
1077
1068
|
bctl->call->used_batches =
|
1078
1069
|
(uint8_t)(bctl->call->used_batches &
|
@@ -1081,7 +1072,7 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx,
|
|
1081
1072
|
GRPC_CALL_INTERNAL_UNREF(exec_ctx, call, "completion");
|
1082
1073
|
} else {
|
1083
1074
|
/* unrefs bctl->error */
|
1084
|
-
grpc_cq_end_op(exec_ctx, bctl->call->cq, bctl->notify_tag,
|
1075
|
+
grpc_cq_end_op(exec_ctx, bctl->call->cq, bctl->notify_tag, error,
|
1085
1076
|
finish_batch_completion, bctl, &bctl->cq_completion);
|
1086
1077
|
}
|
1087
1078
|
}
|
@@ -1104,8 +1095,8 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx,
|
|
1104
1095
|
if (grpc_byte_stream_next(exec_ctx, call->receiving_stream,
|
1105
1096
|
&call->receiving_slice, remaining,
|
1106
1097
|
&call->receiving_slice_ready)) {
|
1107
|
-
|
1108
|
-
|
1098
|
+
grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
|
1099
|
+
call->receiving_slice);
|
1109
1100
|
} else {
|
1110
1101
|
return;
|
1111
1102
|
}
|
@@ -1118,8 +1109,8 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1118
1109
|
grpc_call *call = bctl->call;
|
1119
1110
|
|
1120
1111
|
if (error == GRPC_ERROR_NONE) {
|
1121
|
-
|
1122
|
-
|
1112
|
+
grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
|
1113
|
+
call->receiving_slice);
|
1123
1114
|
continue_receiving_slices(exec_ctx, bctl);
|
1124
1115
|
} else {
|
1125
1116
|
if (grpc_trace_operation_failures) {
|
@@ -1135,8 +1126,8 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1135
1126
|
}
|
1136
1127
|
}
|
1137
1128
|
|
1138
|
-
static void process_data_after_md(grpc_exec_ctx *exec_ctx,
|
1139
|
-
|
1129
|
+
static void process_data_after_md(grpc_exec_ctx *exec_ctx,
|
1130
|
+
batch_control *bctl) {
|
1140
1131
|
grpc_call *call = bctl->call;
|
1141
1132
|
if (call->receiving_stream == NULL) {
|
1142
1133
|
*call->receiving_buffer = NULL;
|
@@ -1144,17 +1135,6 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx, batch_control *bctl,
|
|
1144
1135
|
if (gpr_unref(&bctl->steps_to_complete)) {
|
1145
1136
|
post_batch_completion(exec_ctx, bctl);
|
1146
1137
|
}
|
1147
|
-
} else if (call->receiving_stream->length >
|
1148
|
-
grpc_channel_get_max_message_length(call->channel)) {
|
1149
|
-
cancel_with_status(exec_ctx, call, GRPC_STATUS_INTERNAL,
|
1150
|
-
"Max message size exceeded");
|
1151
|
-
grpc_byte_stream_destroy(exec_ctx, call->receiving_stream);
|
1152
|
-
call->receiving_stream = NULL;
|
1153
|
-
*call->receiving_buffer = NULL;
|
1154
|
-
call->receiving_message = 0;
|
1155
|
-
if (gpr_unref(&bctl->steps_to_complete)) {
|
1156
|
-
post_batch_completion(exec_ctx, bctl);
|
1157
|
-
}
|
1158
1138
|
} else {
|
1159
1139
|
call->test_only_last_message_flags = call->receiving_stream->flags;
|
1160
1140
|
if ((call->receiving_stream->flags & GRPC_WRITE_INTERNAL_COMPRESS) &&
|
@@ -1164,11 +1144,9 @@ static void process_data_after_md(grpc_exec_ctx *exec_ctx, batch_control *bctl,
|
|
1164
1144
|
} else {
|
1165
1145
|
*call->receiving_buffer = grpc_raw_byte_buffer_create(NULL, 0);
|
1166
1146
|
}
|
1167
|
-
grpc_closure_init(&call->receiving_slice_ready, receiving_slice_ready,
|
1168
|
-
|
1147
|
+
grpc_closure_init(&call->receiving_slice_ready, receiving_slice_ready, bctl,
|
1148
|
+
grpc_schedule_on_exec_ctx);
|
1169
1149
|
continue_receiving_slices(exec_ctx, bctl);
|
1170
|
-
/* early out */
|
1171
|
-
return;
|
1172
1150
|
}
|
1173
1151
|
}
|
1174
1152
|
|
@@ -1176,12 +1154,17 @@ static void receiving_stream_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1176
1154
|
grpc_error *error) {
|
1177
1155
|
batch_control *bctl = bctlp;
|
1178
1156
|
grpc_call *call = bctl->call;
|
1179
|
-
|
1157
|
+
if (error != GRPC_ERROR_NONE) {
|
1158
|
+
grpc_status_code status;
|
1159
|
+
const char *msg;
|
1160
|
+
grpc_error_get_status(error, &status, &msg);
|
1161
|
+
close_with_status(exec_ctx, call, status, msg);
|
1162
|
+
}
|
1180
1163
|
gpr_mu_lock(&bctl->call->mu);
|
1181
1164
|
if (bctl->call->has_initial_md_been_received || error != GRPC_ERROR_NONE ||
|
1182
1165
|
call->receiving_stream == NULL) {
|
1183
1166
|
gpr_mu_unlock(&bctl->call->mu);
|
1184
|
-
process_data_after_md(exec_ctx, bctlp
|
1167
|
+
process_data_after_md(exec_ctx, bctlp);
|
1185
1168
|
} else {
|
1186
1169
|
call->saved_receiving_stream_ready_bctlp = bctlp;
|
1187
1170
|
gpr_mu_unlock(&bctl->call->mu);
|
@@ -1238,6 +1221,14 @@ static void validate_filtered_metadata(grpc_exec_ctx *exec_ctx,
|
|
1238
1221
|
}
|
1239
1222
|
}
|
1240
1223
|
|
1224
|
+
static void add_batch_error(batch_control *bctl, grpc_error *error) {
|
1225
|
+
if (error == GRPC_ERROR_NONE) return;
|
1226
|
+
if (bctl->error == GRPC_ERROR_NONE) {
|
1227
|
+
bctl->error = GRPC_ERROR_CREATE("Call batch operation failed");
|
1228
|
+
}
|
1229
|
+
bctl->error = grpc_error_add_child(bctl->error, error);
|
1230
|
+
}
|
1231
|
+
|
1241
1232
|
static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
|
1242
1233
|
void *bctlp, grpc_error *error) {
|
1243
1234
|
batch_control *bctl = bctlp;
|
@@ -1245,12 +1236,11 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
|
|
1245
1236
|
|
1246
1237
|
gpr_mu_lock(&call->mu);
|
1247
1238
|
|
1248
|
-
|
1249
|
-
|
1250
|
-
} else {
|
1239
|
+
add_batch_error(bctl, GRPC_ERROR_REF(error));
|
1240
|
+
if (error == GRPC_ERROR_NONE) {
|
1251
1241
|
grpc_metadata_batch *md =
|
1252
1242
|
&call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */];
|
1253
|
-
grpc_metadata_batch_filter(md, recv_initial_filter, call);
|
1243
|
+
grpc_metadata_batch_filter(exec_ctx, md, recv_initial_filter, call);
|
1254
1244
|
|
1255
1245
|
GPR_TIMER_BEGIN("validate_filtered_metadata", 0);
|
1256
1246
|
validate_filtered_metadata(exec_ctx, bctl);
|
@@ -1259,18 +1249,18 @@ static void receiving_initial_metadata_ready(grpc_exec_ctx *exec_ctx,
|
|
1259
1249
|
if (gpr_time_cmp(md->deadline, gpr_inf_future(md->deadline.clock_type)) !=
|
1260
1250
|
0 &&
|
1261
1251
|
!call->is_client) {
|
1262
|
-
|
1263
|
-
|
1264
|
-
GPR_TIMER_END("set_deadline_alarm", 0);
|
1252
|
+
call->send_deadline =
|
1253
|
+
gpr_convert_clock_type(md->deadline, GPR_CLOCK_MONOTONIC);
|
1265
1254
|
}
|
1266
1255
|
}
|
1267
1256
|
|
1268
1257
|
call->has_initial_md_been_received = true;
|
1269
1258
|
if (call->saved_receiving_stream_ready_bctlp != NULL) {
|
1270
1259
|
grpc_closure *saved_rsr_closure = grpc_closure_create(
|
1271
|
-
receiving_stream_ready, call->saved_receiving_stream_ready_bctlp
|
1260
|
+
receiving_stream_ready, call->saved_receiving_stream_ready_bctlp,
|
1261
|
+
grpc_schedule_on_exec_ctx);
|
1272
1262
|
call->saved_receiving_stream_ready_bctlp = NULL;
|
1273
|
-
|
1263
|
+
grpc_closure_sched(exec_ctx, saved_rsr_closure, error);
|
1274
1264
|
}
|
1275
1265
|
|
1276
1266
|
gpr_mu_unlock(&call->mu);
|
@@ -1290,11 +1280,20 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1290
1280
|
GRPC_ERROR_REF(error);
|
1291
1281
|
|
1292
1282
|
gpr_mu_lock(&call->mu);
|
1283
|
+
|
1284
|
+
// If the error has an associated status code, set the call's status.
|
1285
|
+
intptr_t status;
|
1286
|
+
if (error != GRPC_ERROR_NONE &&
|
1287
|
+
grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, &status)) {
|
1288
|
+
set_status_from_error(exec_ctx, call, STATUS_FROM_CORE, error);
|
1289
|
+
}
|
1290
|
+
|
1293
1291
|
if (bctl->send_initial_metadata) {
|
1294
1292
|
if (error != GRPC_ERROR_NONE) {
|
1295
|
-
|
1293
|
+
set_status_from_error(exec_ctx, call, STATUS_FROM_CORE, error);
|
1296
1294
|
}
|
1297
1295
|
grpc_metadata_batch_destroy(
|
1296
|
+
exec_ctx,
|
1298
1297
|
&call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]);
|
1299
1298
|
}
|
1300
1299
|
if (bctl->send_message) {
|
@@ -1302,17 +1301,15 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1302
1301
|
}
|
1303
1302
|
if (bctl->send_final_op) {
|
1304
1303
|
grpc_metadata_batch_destroy(
|
1304
|
+
exec_ctx,
|
1305
1305
|
&call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */]);
|
1306
1306
|
}
|
1307
1307
|
if (bctl->recv_final_op) {
|
1308
1308
|
grpc_metadata_batch *md =
|
1309
1309
|
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
1310
|
-
grpc_metadata_batch_filter(md, recv_trailing_filter, call);
|
1310
|
+
grpc_metadata_batch_filter(exec_ctx, md, recv_trailing_filter, call);
|
1311
1311
|
|
1312
1312
|
call->received_final_op = true;
|
1313
|
-
if (call->have_alarm) {
|
1314
|
-
grpc_timer_cancel(exec_ctx, &call->alarm);
|
1315
|
-
}
|
1316
1313
|
/* propagate cancellation to any interested children */
|
1317
1314
|
child_call = call->first_child;
|
1318
1315
|
if (child_call != NULL) {
|
@@ -1340,8 +1337,7 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp,
|
|
1340
1337
|
GRPC_ERROR_UNREF(error);
|
1341
1338
|
error = GRPC_ERROR_NONE;
|
1342
1339
|
}
|
1343
|
-
|
1344
|
-
bctl->error = GRPC_ERROR_REF(error);
|
1340
|
+
add_batch_error(bctl, GRPC_ERROR_REF(error));
|
1345
1341
|
gpr_mu_unlock(&call->mu);
|
1346
1342
|
if (gpr_unref(&bctl->steps_to_complete)) {
|
1347
1343
|
post_batch_completion(exec_ctx, bctl);
|
@@ -1354,19 +1350,19 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1354
1350
|
grpc_call *call, const grpc_op *ops,
|
1355
1351
|
size_t nops, void *notify_tag,
|
1356
1352
|
int is_notify_tag_closure) {
|
1357
|
-
grpc_transport_stream_op stream_op;
|
1358
1353
|
size_t i;
|
1359
1354
|
const grpc_op *op;
|
1360
1355
|
batch_control *bctl;
|
1361
1356
|
int num_completion_callbacks_needed = 1;
|
1362
1357
|
grpc_call_error error = GRPC_CALL_OK;
|
1363
1358
|
|
1359
|
+
// sent_initial_metadata guards against variable reuse.
|
1360
|
+
grpc_metadata compression_md;
|
1361
|
+
|
1364
1362
|
GPR_TIMER_BEGIN("grpc_call_start_batch", 0);
|
1365
1363
|
|
1366
1364
|
GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag);
|
1367
1365
|
|
1368
|
-
memset(&stream_op, 0, sizeof(stream_op));
|
1369
|
-
|
1370
1366
|
/* TODO(ctiller): this feels like it could be made lock-free */
|
1371
1367
|
gpr_mu_lock(&call->mu);
|
1372
1368
|
bctl = allocate_batch_control(call);
|
@@ -1375,6 +1371,10 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1375
1371
|
bctl->notify_tag = notify_tag;
|
1376
1372
|
bctl->is_notify_tag_closure = (uint8_t)(is_notify_tag_closure != 0);
|
1377
1373
|
|
1374
|
+
grpc_transport_stream_op *stream_op = &bctl->op;
|
1375
|
+
memset(stream_op, 0, sizeof(*stream_op));
|
1376
|
+
stream_op->covered_by_poller = true;
|
1377
|
+
|
1378
1378
|
if (nops == 0) {
|
1379
1379
|
GRPC_CALL_INTERNAL_REF(call, "completion");
|
1380
1380
|
bctl->error = GRPC_ERROR_NONE;
|
@@ -1406,8 +1406,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1406
1406
|
goto done_with_error;
|
1407
1407
|
}
|
1408
1408
|
/* process compression level */
|
1409
|
-
|
1410
|
-
memset(&compression_md, 0, sizeof(grpc_metadata));
|
1409
|
+
memset(&compression_md, 0, sizeof(compression_md));
|
1411
1410
|
size_t additional_metadata_count = 0;
|
1412
1411
|
grpc_compression_level effective_compression_level;
|
1413
1412
|
bool level_set = false;
|
@@ -1445,7 +1444,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1445
1444
|
bctl->send_initial_metadata = 1;
|
1446
1445
|
call->sent_initial_metadata = 1;
|
1447
1446
|
if (!prepare_application_metadata(
|
1448
|
-
call, (int)op->data.send_initial_metadata.count,
|
1447
|
+
exec_ctx, call, (int)op->data.send_initial_metadata.count,
|
1449
1448
|
op->data.send_initial_metadata.metadata, 0, call->is_client,
|
1450
1449
|
&compression_md, (int)additional_metadata_count)) {
|
1451
1450
|
error = GRPC_CALL_ERROR_INVALID_METADATA;
|
@@ -1453,16 +1452,16 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1453
1452
|
}
|
1454
1453
|
/* TODO(ctiller): just make these the same variable? */
|
1455
1454
|
call->metadata_batch[0][0].deadline = call->send_deadline;
|
1456
|
-
stream_op
|
1455
|
+
stream_op->send_initial_metadata =
|
1457
1456
|
&call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */];
|
1458
|
-
stream_op
|
1457
|
+
stream_op->send_initial_metadata_flags = op->flags;
|
1459
1458
|
break;
|
1460
1459
|
case GRPC_OP_SEND_MESSAGE:
|
1461
1460
|
if (!are_write_flags_valid(op->flags)) {
|
1462
1461
|
error = GRPC_CALL_ERROR_INVALID_FLAGS;
|
1463
1462
|
goto done_with_error;
|
1464
1463
|
}
|
1465
|
-
if (op->data.send_message == NULL) {
|
1464
|
+
if (op->data.send_message.send_message == NULL) {
|
1466
1465
|
error = GRPC_CALL_ERROR_INVALID_MESSAGE;
|
1467
1466
|
goto done_with_error;
|
1468
1467
|
}
|
@@ -1474,8 +1473,16 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1474
1473
|
call->sending_message = 1;
|
1475
1474
|
grpc_slice_buffer_stream_init(
|
1476
1475
|
&call->sending_stream,
|
1477
|
-
&op->data.send_message->data.raw.slice_buffer,
|
1478
|
-
|
1476
|
+
&op->data.send_message.send_message->data.raw.slice_buffer,
|
1477
|
+
op->flags);
|
1478
|
+
/* If the outgoing buffer is already compressed, mark it as so in the
|
1479
|
+
flags. These will be picked up by the compression filter and further
|
1480
|
+
(wasteful) attempts at compression skipped. */
|
1481
|
+
if (op->data.send_message.send_message->data.raw.compression >
|
1482
|
+
GRPC_COMPRESS_NONE) {
|
1483
|
+
call->sending_stream.base.flags |= GRPC_WRITE_INTERNAL_COMPRESS;
|
1484
|
+
}
|
1485
|
+
stream_op->send_message = &call->sending_stream.base;
|
1479
1486
|
break;
|
1480
1487
|
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
1481
1488
|
/* Flag validation: currently allow no flags */
|
@@ -1493,7 +1500,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1493
1500
|
}
|
1494
1501
|
bctl->send_final_op = 1;
|
1495
1502
|
call->sent_final_op = 1;
|
1496
|
-
stream_op
|
1503
|
+
stream_op->send_trailing_metadata =
|
1497
1504
|
&call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */];
|
1498
1505
|
break;
|
1499
1506
|
case GRPC_OP_SEND_STATUS_FROM_SERVER:
|
@@ -1519,28 +1526,30 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1519
1526
|
call->sent_final_op = 1;
|
1520
1527
|
call->send_extra_metadata_count = 1;
|
1521
1528
|
call->send_extra_metadata[0].md = grpc_channel_get_reffed_status_elem(
|
1522
|
-
call->channel, op->data.send_status_from_server.status);
|
1529
|
+
exec_ctx, call->channel, op->data.send_status_from_server.status);
|
1523
1530
|
if (op->data.send_status_from_server.status_details != NULL) {
|
1524
1531
|
call->send_extra_metadata[1].md = grpc_mdelem_from_metadata_strings(
|
1525
|
-
GRPC_MDSTR_GRPC_MESSAGE,
|
1532
|
+
exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
|
1526
1533
|
grpc_mdstr_from_string(
|
1527
1534
|
op->data.send_status_from_server.status_details));
|
1528
1535
|
call->send_extra_metadata_count++;
|
1529
1536
|
set_status_details(
|
1530
|
-
call, STATUS_FROM_API_OVERRIDE,
|
1537
|
+
exec_ctx, call, STATUS_FROM_API_OVERRIDE,
|
1531
1538
|
GRPC_MDSTR_REF(call->send_extra_metadata[1].md->value));
|
1532
1539
|
}
|
1533
|
-
|
1534
|
-
|
1540
|
+
if (op->data.send_status_from_server.status != GRPC_STATUS_OK) {
|
1541
|
+
set_status_code(call, STATUS_FROM_API_OVERRIDE,
|
1542
|
+
(uint32_t)op->data.send_status_from_server.status);
|
1543
|
+
}
|
1535
1544
|
if (!prepare_application_metadata(
|
1536
|
-
call,
|
1545
|
+
exec_ctx, call,
|
1537
1546
|
(int)op->data.send_status_from_server.trailing_metadata_count,
|
1538
1547
|
op->data.send_status_from_server.trailing_metadata, 1, 1, NULL,
|
1539
1548
|
0)) {
|
1540
1549
|
error = GRPC_CALL_ERROR_INVALID_METADATA;
|
1541
1550
|
goto done_with_error;
|
1542
1551
|
}
|
1543
|
-
stream_op
|
1552
|
+
stream_op->send_trailing_metadata =
|
1544
1553
|
&call->metadata_batch[0 /* is_receiving */][1 /* is_trailing */];
|
1545
1554
|
break;
|
1546
1555
|
case GRPC_OP_RECV_INITIAL_METADATA:
|
@@ -1553,14 +1562,20 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1553
1562
|
error = GRPC_CALL_ERROR_TOO_MANY_OPERATIONS;
|
1554
1563
|
goto done_with_error;
|
1555
1564
|
}
|
1565
|
+
/* IF this is a server, then GRPC_OP_RECV_INITIAL_METADATA *must* come
|
1566
|
+
from server.c. In that case, it's coming from accept_stream, and in
|
1567
|
+
that case we're not necessarily covered by a poller. */
|
1568
|
+
stream_op->covered_by_poller = call->is_client;
|
1556
1569
|
call->received_initial_metadata = 1;
|
1557
|
-
call->buffered_metadata[0] =
|
1570
|
+
call->buffered_metadata[0] =
|
1571
|
+
op->data.recv_initial_metadata.recv_initial_metadata;
|
1558
1572
|
grpc_closure_init(&call->receiving_initial_metadata_ready,
|
1559
|
-
receiving_initial_metadata_ready, bctl
|
1573
|
+
receiving_initial_metadata_ready, bctl,
|
1574
|
+
grpc_schedule_on_exec_ctx);
|
1560
1575
|
bctl->recv_initial_metadata = 1;
|
1561
|
-
stream_op
|
1576
|
+
stream_op->recv_initial_metadata =
|
1562
1577
|
&call->metadata_batch[1 /* is_receiving */][0 /* is_trailing */];
|
1563
|
-
stream_op
|
1578
|
+
stream_op->recv_initial_metadata_ready =
|
1564
1579
|
&call->receiving_initial_metadata_ready;
|
1565
1580
|
num_completion_callbacks_needed++;
|
1566
1581
|
break;
|
@@ -1576,11 +1591,11 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1576
1591
|
}
|
1577
1592
|
call->receiving_message = 1;
|
1578
1593
|
bctl->recv_message = 1;
|
1579
|
-
call->receiving_buffer = op->data.recv_message;
|
1580
|
-
stream_op
|
1594
|
+
call->receiving_buffer = op->data.recv_message.recv_message;
|
1595
|
+
stream_op->recv_message = &call->receiving_stream;
|
1581
1596
|
grpc_closure_init(&call->receiving_stream_ready, receiving_stream_ready,
|
1582
|
-
bctl);
|
1583
|
-
stream_op
|
1597
|
+
bctl, grpc_schedule_on_exec_ctx);
|
1598
|
+
stream_op->recv_message_ready = &call->receiving_stream_ready;
|
1584
1599
|
num_completion_callbacks_needed++;
|
1585
1600
|
break;
|
1586
1601
|
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
@@ -1606,9 +1621,10 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1606
1621
|
call->final_op.client.status_details_capacity =
|
1607
1622
|
op->data.recv_status_on_client.status_details_capacity;
|
1608
1623
|
bctl->recv_final_op = 1;
|
1609
|
-
stream_op
|
1624
|
+
stream_op->recv_trailing_metadata =
|
1610
1625
|
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
1611
|
-
stream_op
|
1626
|
+
stream_op->collect_stats =
|
1627
|
+
&call->final_info.stats.transport_stream_stats;
|
1612
1628
|
break;
|
1613
1629
|
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
1614
1630
|
/* Flag validation: currently allow no flags */
|
@@ -1628,9 +1644,10 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1628
1644
|
call->final_op.server.cancelled =
|
1629
1645
|
op->data.recv_close_on_server.cancelled;
|
1630
1646
|
bctl->recv_final_op = 1;
|
1631
|
-
stream_op
|
1647
|
+
stream_op->recv_trailing_metadata =
|
1632
1648
|
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
1633
|
-
stream_op
|
1649
|
+
stream_op->collect_stats =
|
1650
|
+
&call->final_info.stats.transport_stream_stats;
|
1634
1651
|
break;
|
1635
1652
|
}
|
1636
1653
|
}
|
@@ -1641,12 +1658,13 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
|
1641
1658
|
}
|
1642
1659
|
gpr_ref_init(&bctl->steps_to_complete, num_completion_callbacks_needed);
|
1643
1660
|
|
1644
|
-
stream_op
|
1645
|
-
grpc_closure_init(&bctl->finish_batch, finish_batch, bctl
|
1646
|
-
|
1661
|
+
stream_op->context = call->context;
|
1662
|
+
grpc_closure_init(&bctl->finish_batch, finish_batch, bctl,
|
1663
|
+
grpc_schedule_on_exec_ctx);
|
1664
|
+
stream_op->on_complete = &bctl->finish_batch;
|
1647
1665
|
gpr_mu_unlock(&call->mu);
|
1648
1666
|
|
1649
|
-
execute_op(exec_ctx, call,
|
1667
|
+
execute_op(exec_ctx, call, stream_op);
|
1650
1668
|
|
1651
1669
|
done:
|
1652
1670
|
GPR_TIMER_END("grpc_call_start_batch", 0);
|
@@ -1656,7 +1674,7 @@ done_with_error:
|
|
1656
1674
|
/* reverse any mutations that occured */
|
1657
1675
|
if (bctl->send_initial_metadata) {
|
1658
1676
|
call->sent_initial_metadata = 0;
|
1659
|
-
grpc_metadata_batch_clear(&call->metadata_batch[0][0]);
|
1677
|
+
grpc_metadata_batch_clear(exec_ctx, &call->metadata_batch[0][0]);
|
1660
1678
|
}
|
1661
1679
|
if (bctl->send_message) {
|
1662
1680
|
call->sending_message = 0;
|
@@ -1664,7 +1682,7 @@ done_with_error:
|
|
1664
1682
|
}
|
1665
1683
|
if (bctl->send_final_op) {
|
1666
1684
|
call->sent_final_op = 0;
|
1667
|
-
grpc_metadata_batch_clear(&call->metadata_batch[0][1]);
|
1685
|
+
grpc_metadata_batch_clear(exec_ctx, &call->metadata_batch[0][1]);
|
1668
1686
|
}
|
1669
1687
|
if (bctl->recv_initial_metadata) {
|
1670
1688
|
call->received_initial_metadata = 0;
|