grpc 1.2.5 → 1.3.4
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 +1434 -399
- data/etc/roots.pem +34 -150
- data/include/grpc/grpc.h +71 -0
- data/include/grpc/impl/codegen/atm.h +5 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +11 -0
- data/include/grpc/impl/codegen/grpc_types.h +54 -13
- data/include/grpc/impl/codegen/port_platform.h +15 -1
- data/include/grpc/support/alloc.h +2 -1
- data/include/grpc/support/sync.h +4 -0
- data/include/grpc/support/tls.h +1 -1
- data/src/core/ext/census/gen/trace_context.pb.h +1 -1
- data/src/core/ext/census/grpc_filter.c +14 -10
- data/src/core/ext/census/grpc_plugin.c +3 -1
- data/src/core/ext/census/trace_label.h +1 -1
- data/src/core/ext/census/trace_propagation.h +1 -1
- data/src/core/ext/census/trace_status.h +1 -1
- data/src/core/ext/census/trace_string.h +1 -1
- data/src/core/ext/census/tracing.h +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
- data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
- data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
- data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
- data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
- data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
- data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
- data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
- data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
- data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
- data/src/core/lib/channel/channel_args.c +7 -0
- data/src/core/lib/channel/channel_args.h +2 -0
- data/src/core/lib/channel/channel_stack.c +20 -27
- data/src/core/lib/channel/channel_stack.h +18 -16
- data/src/core/lib/channel/compress_filter.c +20 -18
- data/src/core/lib/channel/connected_channel.c +9 -8
- data/src/core/lib/channel/deadline_filter.c +28 -24
- data/src/core/lib/channel/deadline_filter.h +3 -3
- data/src/core/lib/channel/handshaker.c +3 -2
- data/src/core/lib/channel/http_client_filter.c +119 -61
- data/src/core/lib/channel/http_server_filter.c +124 -69
- data/src/core/lib/channel/message_size_filter.c +23 -19
- data/src/core/lib/http/httpcli.c +8 -6
- data/src/core/lib/http/httpcli_security_connector.c +5 -5
- data/src/core/lib/http/parser.c +57 -31
- data/src/core/lib/iomgr/closure.c +15 -0
- data/src/core/lib/iomgr/closure.h +4 -0
- data/src/core/lib/iomgr/combiner.c +8 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
- data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
- data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
- data/src/core/lib/iomgr/error.c +360 -177
- data/src/core/lib/iomgr/error.h +31 -33
- data/src/core/lib/iomgr/error_internal.h +30 -9
- data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
- data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
- data/src/core/lib/iomgr/ev_posix.c +6 -0
- data/src/core/lib/iomgr/ev_posix.h +3 -0
- data/src/core/lib/iomgr/exec_ctx.c +6 -0
- data/src/core/lib/iomgr/executor.c +8 -2
- data/src/core/lib/iomgr/load_file.c +6 -3
- data/src/core/lib/iomgr/lockfree_event.c +238 -0
- data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
- data/src/core/lib/iomgr/pollset.h +4 -0
- data/src/core/lib/iomgr/pollset_windows.c +2 -2
- data/src/core/lib/iomgr/port.h +9 -0
- data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
- data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
- data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
- data/src/core/lib/iomgr/resource_quota.c +19 -4
- data/src/core/lib/iomgr/resource_quota.h +2 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
- data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
- data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
- data/src/core/lib/iomgr/tcp_client.h +0 -4
- data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
- data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
- data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
- data/src/core/lib/iomgr/tcp_posix.c +111 -22
- data/src/core/lib/iomgr/tcp_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
- data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
- data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
- data/src/core/lib/iomgr/tcp_uv.c +16 -13
- data/src/core/lib/iomgr/tcp_windows.c +24 -12
- data/src/core/lib/iomgr/tcp_windows.h +2 -2
- data/src/core/lib/iomgr/timer.h +3 -0
- data/src/core/lib/iomgr/timer_generic.c +257 -72
- data/src/core/lib/iomgr/timer_generic.h +1 -1
- data/src/core/lib/iomgr/timer_heap.c +8 -8
- data/src/core/lib/iomgr/udp_server.c +54 -24
- data/src/core/lib/iomgr/udp_server.h +7 -7
- data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
- data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
- data/src/core/lib/profiling/basic_timers.c +1 -1
- data/src/core/lib/security/credentials/credentials.h +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
- data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
- data/src/core/lib/security/transport/client_auth_filter.c +33 -26
- data/src/core/lib/security/transport/secure_endpoint.c +8 -5
- data/src/core/lib/security/transport/security_connector.c +37 -37
- data/src/core/lib/security/transport/security_connector.h +1 -1
- data/src/core/lib/security/transport/security_handshaker.c +15 -12
- data/src/core/lib/security/transport/server_auth_filter.c +20 -18
- data/src/core/lib/security/transport/tsi_error.c +5 -3
- data/src/core/lib/security/transport/tsi_error.h +1 -1
- data/src/core/lib/{security/util → slice}/b64.c +21 -6
- data/src/core/lib/{security/util → slice}/b64.h +16 -4
- data/src/core/lib/slice/slice.c +4 -2
- data/src/core/lib/slice/slice_buffer.c +16 -14
- data/src/core/lib/support/arena.c +98 -0
- data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
- data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
- data/src/core/lib/support/cpu_linux.c +5 -0
- data/src/core/lib/support/sync.c +4 -0
- data/src/core/lib/support/time.c +4 -10
- data/src/core/lib/support/wrap_memcpy.c +3 -1
- data/src/core/lib/surface/call.c +252 -221
- data/src/core/lib/surface/channel.c +72 -21
- data/src/core/lib/surface/channel.h +8 -0
- data/src/core/lib/surface/completion_queue.c +2 -3
- data/src/core/lib/surface/completion_queue_factory.c +77 -0
- data/src/core/lib/surface/completion_queue_factory.h +51 -0
- data/src/core/lib/surface/init_secure.c +3 -1
- data/src/core/lib/surface/lame_client.c +18 -14
- data/src/core/lib/surface/server.c +43 -41
- data/src/core/lib/surface/validate_metadata.c +8 -4
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.h +1 -1
- data/src/core/lib/transport/connectivity_state.c +2 -1
- data/src/core/lib/transport/error_utils.c +17 -17
- data/src/core/lib/transport/error_utils.h +1 -1
- data/src/core/lib/transport/metadata_batch.c +6 -7
- data/src/core/lib/transport/pid_controller.c +1 -0
- data/src/core/lib/transport/service_config.c +12 -0
- data/src/core/lib/transport/service_config.h +6 -0
- data/src/core/lib/transport/transport.c +29 -17
- data/src/core/lib/transport/transport.h +85 -42
- data/src/core/lib/transport/transport_impl.h +5 -3
- data/src/core/lib/transport/transport_op_string.c +20 -14
- data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
- data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
- data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
- data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
- data/src/ruby/ext/grpc/rb_channel.c +520 -93
- data/src/ruby/ext/grpc/rb_channel.h +2 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
- data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
- data/src/ruby/ext/grpc/rb_grpc.c +29 -7
- data/src/ruby/ext/grpc/rb_grpc.h +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +173 -0
- data/src/ruby/spec/channel_spec.rb +29 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
- data/third_party/cares/ares_build.h +264 -0
- data/third_party/cares/cares/ares.h +636 -0
- data/third_party/cares/cares/ares__close_sockets.c +61 -0
- data/third_party/cares/cares/ares__get_hostent.c +261 -0
- data/third_party/cares/cares/ares__read_line.c +73 -0
- data/third_party/cares/cares/ares__timeval.c +111 -0
- data/third_party/cares/cares/ares_cancel.c +63 -0
- data/third_party/cares/cares/ares_create_query.c +202 -0
- data/third_party/cares/cares/ares_data.c +221 -0
- data/third_party/cares/cares/ares_data.h +72 -0
- data/third_party/cares/cares/ares_destroy.c +108 -0
- data/third_party/cares/cares/ares_dns.h +103 -0
- data/third_party/cares/cares/ares_expand_name.c +205 -0
- data/third_party/cares/cares/ares_expand_string.c +70 -0
- data/third_party/cares/cares/ares_fds.c +59 -0
- data/third_party/cares/cares/ares_free_hostent.c +41 -0
- data/third_party/cares/cares/ares_free_string.c +25 -0
- data/third_party/cares/cares/ares_getenv.c +30 -0
- data/third_party/cares/cares/ares_getenv.h +26 -0
- data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
- data/third_party/cares/cares/ares_gethostbyname.c +518 -0
- data/third_party/cares/cares/ares_getnameinfo.c +422 -0
- data/third_party/cares/cares/ares_getopt.c +122 -0
- data/third_party/cares/cares/ares_getopt.h +53 -0
- data/third_party/cares/cares/ares_getsock.c +66 -0
- data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
- data/third_party/cares/cares/ares_init.c +2146 -0
- data/third_party/cares/cares/ares_iphlpapi.h +221 -0
- data/third_party/cares/cares/ares_ipv6.h +78 -0
- data/third_party/cares/cares/ares_library_init.c +167 -0
- data/third_party/cares/cares/ares_library_init.h +42 -0
- data/third_party/cares/cares/ares_llist.c +63 -0
- data/third_party/cares/cares/ares_llist.h +39 -0
- data/third_party/cares/cares/ares_mkquery.c +24 -0
- data/third_party/cares/cares/ares_nowarn.c +260 -0
- data/third_party/cares/cares/ares_nowarn.h +61 -0
- data/third_party/cares/cares/ares_options.c +402 -0
- data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
- data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
- data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
- data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
- data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
- data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
- data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
- data/third_party/cares/cares/ares_platform.c +11035 -0
- data/third_party/cares/cares/ares_platform.h +43 -0
- data/third_party/cares/cares/ares_private.h +363 -0
- data/third_party/cares/cares/ares_process.c +1359 -0
- data/third_party/cares/cares/ares_query.c +186 -0
- data/third_party/cares/cares/ares_rules.h +125 -0
- data/third_party/cares/cares/ares_search.c +316 -0
- data/third_party/cares/cares/ares_send.c +131 -0
- data/third_party/cares/cares/ares_setup.h +217 -0
- data/third_party/cares/cares/ares_strcasecmp.c +66 -0
- data/third_party/cares/cares/ares_strcasecmp.h +30 -0
- data/third_party/cares/cares/ares_strdup.c +49 -0
- data/third_party/cares/cares/ares_strdup.h +24 -0
- data/third_party/cares/cares/ares_strerror.c +56 -0
- data/third_party/cares/cares/ares_timeout.c +88 -0
- data/third_party/cares/cares/ares_version.c +11 -0
- data/third_party/cares/cares/ares_version.h +24 -0
- data/third_party/cares/cares/ares_writev.c +79 -0
- data/third_party/cares/cares/bitncmp.c +59 -0
- data/third_party/cares/cares/bitncmp.h +26 -0
- data/third_party/cares/cares/config-win32.h +377 -0
- data/third_party/cares/cares/inet_net_pton.c +450 -0
- data/third_party/cares/cares/inet_ntop.c +208 -0
- data/third_party/cares/cares/setup_once.h +554 -0
- data/third_party/cares/cares/windows_port.c +22 -0
- data/third_party/cares/config_darwin/ares_config.h +523 -0
- data/third_party/cares/config_linux/ares_config.h +524 -0
- metadata +164 -68
@@ -0,0 +1,49 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2017, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
* * Redistributions in binary form must reproduce the above
|
13
|
+
* copyright notice, this list of conditions and the following disclaimer
|
14
|
+
* in the documentation and/or other materials provided with the
|
15
|
+
* distribution.
|
16
|
+
* * Neither the name of Google Inc. nor the names of its
|
17
|
+
* contributors may be used to endorse or promote products derived from
|
18
|
+
* this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
#include "src/core/lib/iomgr/port.h"
|
35
|
+
|
36
|
+
#if defined(GRPC_POSIX_SOCKET) && !defined(GRPC_HAVE_IFADDRS)
|
37
|
+
|
38
|
+
#include "src/core/lib/iomgr/tcp_server_utils_posix.h"
|
39
|
+
|
40
|
+
grpc_error *grpc_tcp_server_add_all_local_addrs(grpc_tcp_server *s,
|
41
|
+
unsigned port_index,
|
42
|
+
int requested_port,
|
43
|
+
int *out_port) {
|
44
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("no ifaddrs available");
|
45
|
+
}
|
46
|
+
|
47
|
+
bool grpc_tcp_server_have_ifaddrs(void) { return false; }
|
48
|
+
|
49
|
+
#endif /* defined(GRPC_POSIX_SOCKET) && !defined(GRPC_HAVE_IFADDRS) */
|
@@ -56,6 +56,8 @@ struct grpc_tcp_listener {
|
|
56
56
|
int port;
|
57
57
|
/* linked list */
|
58
58
|
struct grpc_tcp_listener *next;
|
59
|
+
|
60
|
+
bool closed;
|
59
61
|
};
|
60
62
|
|
61
63
|
struct grpc_tcp_server {
|
@@ -77,6 +79,8 @@ struct grpc_tcp_server {
|
|
77
79
|
/* shutdown callback */
|
78
80
|
grpc_closure *shutdown_complete;
|
79
81
|
|
82
|
+
bool shutdown;
|
83
|
+
|
80
84
|
grpc_resource_quota *resource_quota;
|
81
85
|
};
|
82
86
|
|
@@ -95,8 +99,8 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx,
|
|
95
99
|
} else {
|
96
100
|
grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota);
|
97
101
|
gpr_free(s);
|
98
|
-
return
|
99
|
-
|
102
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
103
|
+
GRPC_ARG_RESOURCE_QUOTA " must be a pointer to a buffer pool");
|
100
104
|
}
|
101
105
|
}
|
102
106
|
}
|
@@ -109,6 +113,7 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx,
|
|
109
113
|
s->shutdown_starting.head = NULL;
|
110
114
|
s->shutdown_starting.tail = NULL;
|
111
115
|
s->shutdown_complete = shutdown_complete;
|
116
|
+
s->shutdown = false;
|
112
117
|
*server = s;
|
113
118
|
return GRPC_ERROR_NONE;
|
114
119
|
}
|
@@ -125,6 +130,7 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s,
|
|
125
130
|
}
|
126
131
|
|
127
132
|
static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
|
133
|
+
GPR_ASSERT(s->shutdown);
|
128
134
|
if (s->shutdown_complete != NULL) {
|
129
135
|
grpc_closure_sched(exec_ctx, s->shutdown_complete, GRPC_ERROR_NONE);
|
130
136
|
}
|
@@ -144,21 +150,31 @@ static void handle_close_callback(uv_handle_t *handle) {
|
|
144
150
|
grpc_tcp_listener *sp = (grpc_tcp_listener *)handle->data;
|
145
151
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
|
146
152
|
sp->server->open_ports--;
|
147
|
-
if (sp->server->open_ports == 0) {
|
153
|
+
if (sp->server->open_ports == 0 && sp->server->shutdown) {
|
148
154
|
finish_shutdown(&exec_ctx, sp->server);
|
149
155
|
}
|
150
156
|
grpc_exec_ctx_finish(&exec_ctx);
|
151
157
|
}
|
152
158
|
|
159
|
+
static void close_listener(grpc_tcp_listener *sp) {
|
160
|
+
if (!sp->closed) {
|
161
|
+
sp->closed = true;
|
162
|
+
uv_close((uv_handle_t *)sp->handle, handle_close_callback);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
153
166
|
static void tcp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
|
154
167
|
int immediately_done = 0;
|
155
168
|
grpc_tcp_listener *sp;
|
156
169
|
|
170
|
+
GPR_ASSERT(!s->shutdown);
|
171
|
+
s->shutdown = true;
|
172
|
+
|
157
173
|
if (s->open_ports == 0) {
|
158
174
|
immediately_done = 1;
|
159
175
|
}
|
160
176
|
for (sp = s->head; sp; sp = sp->next) {
|
161
|
-
|
177
|
+
close_listener(sp);
|
162
178
|
}
|
163
179
|
|
164
180
|
if (immediately_done) {
|
@@ -196,9 +212,14 @@ static void on_connect(uv_stream_t *server, int status) {
|
|
196
212
|
int err;
|
197
213
|
|
198
214
|
if (status < 0) {
|
199
|
-
|
200
|
-
|
201
|
-
|
215
|
+
switch (status) {
|
216
|
+
case UV_EINTR:
|
217
|
+
case UV_EAGAIN:
|
218
|
+
return;
|
219
|
+
default:
|
220
|
+
close_listener(sp);
|
221
|
+
return;
|
222
|
+
}
|
202
223
|
}
|
203
224
|
|
204
225
|
client = gpr_malloc(sizeof(uv_tcp_t));
|
@@ -244,17 +265,19 @@ static grpc_error *add_socket_to_server(grpc_tcp_server *s, uv_tcp_t *handle,
|
|
244
265
|
// The last argument to uv_tcp_bind is flags
|
245
266
|
status = uv_tcp_bind(handle, (struct sockaddr *)addr->addr, 0);
|
246
267
|
if (status != 0) {
|
247
|
-
error =
|
268
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to bind to port");
|
248
269
|
error =
|
249
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
270
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
271
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
250
272
|
return error;
|
251
273
|
}
|
252
274
|
|
253
275
|
status = uv_listen((uv_stream_t *)handle, SOMAXCONN, on_connect);
|
254
276
|
if (status != 0) {
|
255
|
-
error =
|
277
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to listen to port");
|
256
278
|
error =
|
257
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
279
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
280
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
258
281
|
return error;
|
259
282
|
}
|
260
283
|
|
@@ -262,9 +285,10 @@ static grpc_error *add_socket_to_server(grpc_tcp_server *s, uv_tcp_t *handle,
|
|
262
285
|
status = uv_tcp_getsockname(handle, (struct sockaddr *)&sockname_temp.addr,
|
263
286
|
(int *)&sockname_temp.len);
|
264
287
|
if (status != 0) {
|
265
|
-
error =
|
288
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("getsockname failed");
|
266
289
|
error =
|
267
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
290
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
291
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
268
292
|
return error;
|
269
293
|
}
|
270
294
|
|
@@ -284,6 +308,7 @@ static grpc_error *add_socket_to_server(grpc_tcp_server *s, uv_tcp_t *handle,
|
|
284
308
|
sp->handle = handle;
|
285
309
|
sp->port = port;
|
286
310
|
sp->port_index = port_index;
|
311
|
+
sp->closed = false;
|
287
312
|
handle->data = sp;
|
288
313
|
s->open_ports++;
|
289
314
|
GPR_ASSERT(sp->handle);
|
@@ -346,15 +371,17 @@ grpc_error *grpc_tcp_server_add_port(grpc_tcp_server *s,
|
|
346
371
|
if (status == 0) {
|
347
372
|
error = add_socket_to_server(s, handle, addr, port_index, &sp);
|
348
373
|
} else {
|
349
|
-
error =
|
374
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
375
|
+
"Failed to initialize UV tcp handle");
|
350
376
|
error =
|
351
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
377
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
378
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
352
379
|
}
|
353
380
|
|
354
381
|
gpr_free(allocated_addr);
|
355
382
|
|
356
383
|
if (error != GRPC_ERROR_NONE) {
|
357
|
-
grpc_error *error_out =
|
384
|
+
grpc_error *error_out = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
358
385
|
"Failed to add port to server", &error, 1);
|
359
386
|
GRPC_ERROR_UNREF(error);
|
360
387
|
error = error_out;
|
@@ -46,6 +46,7 @@
|
|
46
46
|
#include <grpc/support/sync.h>
|
47
47
|
#include <grpc/support/time.h>
|
48
48
|
|
49
|
+
#include "src/core/lib/channel/channel_args.h"
|
49
50
|
#include "src/core/lib/iomgr/iocp_windows.h"
|
50
51
|
#include "src/core/lib/iomgr/pollset_windows.h"
|
51
52
|
#include "src/core/lib/iomgr/resolve_address.h"
|
@@ -102,7 +103,7 @@ struct grpc_tcp_server {
|
|
102
103
|
/* shutdown callback */
|
103
104
|
grpc_closure *shutdown_complete;
|
104
105
|
|
105
|
-
|
106
|
+
grpc_channel_args *channel_args;
|
106
107
|
};
|
107
108
|
|
108
109
|
/* Public function. Allocates the proper data structures to hold a
|
@@ -112,21 +113,7 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx,
|
|
112
113
|
const grpc_channel_args *args,
|
113
114
|
grpc_tcp_server **server) {
|
114
115
|
grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server));
|
115
|
-
s->
|
116
|
-
for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) {
|
117
|
-
if (0 == strcmp(GRPC_ARG_RESOURCE_QUOTA, args->args[i].key)) {
|
118
|
-
if (args->args[i].type == GRPC_ARG_POINTER) {
|
119
|
-
grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota);
|
120
|
-
s->resource_quota =
|
121
|
-
grpc_resource_quota_ref_internal(args->args[i].value.pointer.p);
|
122
|
-
} else {
|
123
|
-
grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota);
|
124
|
-
gpr_free(s);
|
125
|
-
return GRPC_ERROR_CREATE(GRPC_ARG_RESOURCE_QUOTA
|
126
|
-
" must be a pointer to a buffer pool");
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
116
|
+
s->channel_args = grpc_channel_args_copy(args);
|
130
117
|
gpr_ref_init(&s->refs, 1);
|
131
118
|
gpr_mu_init(&s->mu);
|
132
119
|
s->active_ports = 0;
|
@@ -155,7 +142,7 @@ static void destroy_server(grpc_exec_ctx *exec_ctx, void *arg,
|
|
155
142
|
grpc_winsocket_destroy(sp->socket);
|
156
143
|
gpr_free(sp);
|
157
144
|
}
|
158
|
-
|
145
|
+
grpc_channel_args_destroy(exec_ctx, s->channel_args);
|
159
146
|
gpr_free(s);
|
160
147
|
}
|
161
148
|
|
@@ -248,9 +235,10 @@ failure:
|
|
248
235
|
GPR_ASSERT(error != GRPC_ERROR_NONE);
|
249
236
|
char *tgtaddr = grpc_sockaddr_to_uri(addr);
|
250
237
|
grpc_error_set_int(
|
251
|
-
grpc_error_set_str(
|
238
|
+
grpc_error_set_str(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
252
239
|
"Failed to prepare server socket", &error, 1),
|
253
|
-
GRPC_ERROR_STR_TARGET_ADDRESS,
|
240
|
+
GRPC_ERROR_STR_TARGET_ADDRESS,
|
241
|
+
grpc_slice_from_copied_string(tgtaddr)),
|
254
242
|
GRPC_ERROR_INT_FD, (intptr_t)sock);
|
255
243
|
gpr_free(tgtaddr);
|
256
244
|
GRPC_ERROR_UNREF(error);
|
@@ -382,8 +370,8 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
|
|
382
370
|
gpr_free(utf8_message);
|
383
371
|
}
|
384
372
|
gpr_asprintf(&fd_name, "tcp_server:%s", peer_name_string);
|
385
|
-
ep = grpc_tcp_create(grpc_winsocket_create(sock, fd_name),
|
386
|
-
sp->server->
|
373
|
+
ep = grpc_tcp_create(exec_ctx, grpc_winsocket_create(sock, fd_name),
|
374
|
+
sp->server->channel_args, peer_name_string);
|
387
375
|
gpr_free(fd_name);
|
388
376
|
gpr_free(peer_name_string);
|
389
377
|
} else {
|
@@ -533,7 +521,7 @@ done:
|
|
533
521
|
gpr_free(allocated_addr);
|
534
522
|
|
535
523
|
if (error != GRPC_ERROR_NONE) {
|
536
|
-
grpc_error *error_out =
|
524
|
+
grpc_error *error_out = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
537
525
|
"Failed to add port to server", &error, 1);
|
538
526
|
GRPC_ERROR_UNREF(error);
|
539
527
|
error = error_out;
|
data/src/core/lib/iomgr/tcp_uv.c
CHANGED
@@ -88,12 +88,12 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
|
|
88
88
|
#ifdef GRPC_TCP_REFCOUNT_DEBUG
|
89
89
|
#define TCP_UNREF(exec_ctx, tcp, reason) \
|
90
90
|
tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__)
|
91
|
-
#define TCP_REF(tcp, reason)
|
92
|
-
tcp_ref((exec_ctx), (tcp), (reason), __FILE__, __LINE__)
|
91
|
+
#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__)
|
93
92
|
static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp,
|
94
93
|
const char *reason, const char *file, int line) {
|
95
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
96
|
-
|
94
|
+
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
95
|
+
"TCP unref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason,
|
96
|
+
tcp->refcount.count, tcp->refcount.count - 1);
|
97
97
|
if (gpr_unref(&tcp->refcount)) {
|
98
98
|
tcp_free(exec_ctx, tcp);
|
99
99
|
}
|
@@ -101,8 +101,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp,
|
|
101
101
|
|
102
102
|
static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file,
|
103
103
|
int line) {
|
104
|
-
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
105
|
-
|
104
|
+
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
|
105
|
+
"TCP ref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason,
|
106
|
+
tcp->refcount.count, tcp->refcount.count + 1);
|
106
107
|
gpr_ref(&tcp->refcount);
|
107
108
|
}
|
108
109
|
#else
|
@@ -152,7 +153,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
|
|
152
153
|
// TODO(murgatroid99): figure out what the return value here means
|
153
154
|
uv_read_stop(stream);
|
154
155
|
if (nread == UV_EOF) {
|
155
|
-
error =
|
156
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("EOF");
|
156
157
|
} else if (nread > 0) {
|
157
158
|
// Successful read
|
158
159
|
sub = grpc_slice_sub_no_ref(tcp->read_slice, 0, (size_t)nread);
|
@@ -173,7 +174,7 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
|
|
173
174
|
}
|
174
175
|
} else {
|
175
176
|
// nread < 0: Error
|
176
|
-
error =
|
177
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Read failed");
|
177
178
|
}
|
178
179
|
grpc_closure_sched(&exec_ctx, cb, error);
|
179
180
|
grpc_exec_ctx_finish(&exec_ctx);
|
@@ -193,9 +194,10 @@ static void uv_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
|
193
194
|
status =
|
194
195
|
uv_read_start((uv_stream_t *)tcp->handle, alloc_uv_buf, read_callback);
|
195
196
|
if (status != 0) {
|
196
|
-
error =
|
197
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Read failed at start");
|
197
198
|
error =
|
198
|
-
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
199
|
+
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
|
200
|
+
grpc_slice_from_static_string(uv_strerror(status)));
|
199
201
|
grpc_closure_sched(exec_ctx, cb, error);
|
200
202
|
}
|
201
203
|
if (grpc_tcp_trace) {
|
@@ -214,7 +216,7 @@ static void write_callback(uv_write_t *req, int status) {
|
|
214
216
|
if (status == 0) {
|
215
217
|
error = GRPC_ERROR_NONE;
|
216
218
|
} else {
|
217
|
-
error =
|
219
|
+
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Write failed");
|
218
220
|
}
|
219
221
|
if (grpc_tcp_trace) {
|
220
222
|
const char *str = grpc_error_string(error);
|
@@ -249,8 +251,8 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
|
249
251
|
}
|
250
252
|
|
251
253
|
if (tcp->shutting_down) {
|
252
|
-
grpc_closure_sched(exec_ctx, cb,
|
253
|
-
|
254
|
+
grpc_closure_sched(exec_ctx, cb, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
255
|
+
"TCP socket is shutting down"));
|
254
256
|
return;
|
255
257
|
}
|
256
258
|
|
@@ -310,6 +312,7 @@ static void uv_endpoint_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
|
310
312
|
tcp->shutting_down = true;
|
311
313
|
uv_shutdown_t *req = &tcp->shutdown_req;
|
312
314
|
uv_shutdown(req, (uv_stream_t *)tcp->handle, shutdown_callback);
|
315
|
+
grpc_resource_user_shutdown(exec_ctx, tcp->resource_user);
|
313
316
|
}
|
314
317
|
GRPC_ERROR_UNREF(why);
|
315
318
|
}
|
@@ -175,7 +175,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
|
|
175
175
|
if (error == GRPC_ERROR_NONE) {
|
176
176
|
if (info->wsa_error != 0 && !tcp->shutting_down) {
|
177
177
|
char *utf8_message = gpr_format_message(info->wsa_error);
|
178
|
-
error =
|
178
|
+
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(utf8_message);
|
179
179
|
gpr_free(utf8_message);
|
180
180
|
grpc_slice_unref_internal(exec_ctx, tcp->read_slice);
|
181
181
|
} else {
|
@@ -185,9 +185,9 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
|
|
185
185
|
} else {
|
186
186
|
grpc_slice_unref_internal(exec_ctx, tcp->read_slice);
|
187
187
|
error = tcp->shutting_down
|
188
|
-
?
|
189
|
-
|
190
|
-
:
|
188
|
+
? GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
189
|
+
"TCP stream shutting down", &tcp->shutdown_error, 1)
|
190
|
+
: GRPC_ERROR_CREATE_FROM_STATIC_STRING("End of TCP stream");
|
191
191
|
}
|
192
192
|
}
|
193
193
|
}
|
@@ -208,9 +208,10 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
|
208
208
|
WSABUF buffer;
|
209
209
|
|
210
210
|
if (tcp->shutting_down) {
|
211
|
-
grpc_closure_sched(
|
212
|
-
|
213
|
-
|
211
|
+
grpc_closure_sched(
|
212
|
+
exec_ctx, cb,
|
213
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
214
|
+
"TCP socket is shutting down", &tcp->shutdown_error, 1));
|
214
215
|
return;
|
215
216
|
}
|
216
217
|
|
@@ -297,9 +298,10 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
|
297
298
|
size_t len;
|
298
299
|
|
299
300
|
if (tcp->shutting_down) {
|
300
|
-
grpc_closure_sched(
|
301
|
-
|
302
|
-
|
301
|
+
grpc_closure_sched(
|
302
|
+
exec_ctx, cb,
|
303
|
+
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
304
|
+
"TCP socket is shutting down", &tcp->shutdown_error, 1));
|
303
305
|
return;
|
304
306
|
}
|
305
307
|
|
@@ -428,9 +430,19 @@ static grpc_endpoint_vtable vtable = {win_read,
|
|
428
430
|
win_get_peer,
|
429
431
|
win_get_fd};
|
430
432
|
|
431
|
-
grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket,
|
432
|
-
|
433
|
+
grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket,
|
434
|
+
grpc_channel_args *channel_args,
|
433
435
|
char *peer_string) {
|
436
|
+
grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL);
|
437
|
+
if (channel_args != NULL) {
|
438
|
+
for (size_t i = 0; i < channel_args->num_args; i++) {
|
439
|
+
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) {
|
440
|
+
grpc_resource_quota_unref_internal(exec_ctx, resource_quota);
|
441
|
+
resource_quota = grpc_resource_quota_ref_internal(
|
442
|
+
channel_args->args[i].value.pointer.p);
|
443
|
+
}
|
444
|
+
}
|
445
|
+
}
|
434
446
|
grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));
|
435
447
|
memset(tcp, 0, sizeof(grpc_tcp));
|
436
448
|
tcp->base.vtable = &vtable;
|
@@ -50,8 +50,8 @@
|
|
50
50
|
/* Create a tcp endpoint given a winsock handle.
|
51
51
|
* Takes ownership of the handle.
|
52
52
|
*/
|
53
|
-
grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket,
|
54
|
-
|
53
|
+
grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket,
|
54
|
+
grpc_channel_args *channel_args,
|
55
55
|
char *peer_string);
|
56
56
|
|
57
57
|
grpc_error *grpc_tcp_prepare_socket(SOCKET sock);
|