grpc 1.17.1 → 1.18.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +1228 -988
- data/etc/roots.pem +242 -30
- data/include/grpc/grpc.h +2 -1
- data/include/grpc/grpc_security_constants.h +3 -3
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +2 -0
- data/include/grpc/impl/codegen/compression_types.h +2 -1
- data/include/grpc/impl/codegen/grpc_types.h +1 -1
- data/include/grpc/impl/codegen/port_platform.h +9 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +163 -882
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -4
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +176 -216
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +20 -23
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +49 -52
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +13 -35
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -30
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +69 -225
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +20 -23
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -84
- data/src/core/ext/filters/client_channel/request_routing.cc +936 -0
- data/src/core/ext/filters/client_channel/request_routing.h +177 -0
- data/src/core/ext/filters/client_channel/resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +37 -26
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +30 -18
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +119 -100
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +8 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +5 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +5 -9
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -2
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +17 -17
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +45 -52
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +13 -17
- data/src/core/ext/filters/client_channel/server_address.cc +103 -0
- data/src/core/ext/filters/client_channel/server_address.h +108 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +10 -8
- data/src/core/ext/filters/client_channel/subchannel.h +9 -6
- data/src/core/ext/filters/client_channel/subchannel_index.cc +20 -27
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +3 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +8 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +8 -11
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +24 -54
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -1
- data/src/core/ext/transport/chttp2/transport/context_list.cc +67 -0
- data/src/core/ext/transport/chttp2/transport/context_list.h +53 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +38 -11
- data/src/core/ext/transport/chttp2/transport/writing.cc +5 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/lib/channel/channelz.cc +19 -18
- data/src/core/lib/channel/channelz.h +7 -1
- data/src/core/lib/channel/channelz_registry.cc +3 -2
- data/src/core/lib/debug/trace.cc +3 -0
- data/src/core/lib/debug/trace.h +5 -3
- data/src/core/lib/gpr/sync_posix.cc +96 -4
- data/src/core/lib/gprpp/inlined_vector.h +25 -19
- data/src/core/lib/gprpp/memory.h +2 -11
- data/src/core/lib/gprpp/orphanable.h +18 -82
- data/src/core/lib/gprpp/ref_counted.h +75 -84
- data/src/core/lib/gprpp/ref_counted_ptr.h +22 -17
- data/src/core/lib/http/httpcli_security_connector.cc +101 -94
- data/src/core/lib/http/parser.h +5 -5
- data/src/core/lib/iomgr/buffer_list.cc +16 -5
- data/src/core/lib/iomgr/buffer_list.h +10 -3
- data/src/core/lib/iomgr/call_combiner.cc +50 -2
- data/src/core/lib/iomgr/call_combiner.h +29 -2
- data/src/core/lib/iomgr/dynamic_annotations.h +67 -0
- data/src/core/lib/iomgr/endpoint.cc +4 -0
- data/src/core/lib/iomgr/endpoint.h +3 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_poll_posix.cc +4 -0
- data/src/core/lib/iomgr/ev_posix.cc +15 -7
- data/src/core/lib/iomgr/ev_posix.h +10 -0
- data/src/core/lib/iomgr/exec_ctx.cc +13 -0
- data/src/core/lib/iomgr/fork_posix.cc +1 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +36 -3
- data/src/core/lib/iomgr/internal_errqueue.h +7 -1
- data/src/core/lib/iomgr/iomgr.cc +7 -0
- data/src/core/lib/iomgr/iomgr.h +4 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +3 -1
- data/src/core/lib/iomgr/iomgr_internal.cc +4 -0
- data/src/core/lib/iomgr/iomgr_internal.h +4 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +6 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +4 -1
- data/src/core/lib/iomgr/port.h +1 -2
- data/src/core/lib/iomgr/resource_quota.cc +1 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -0
- data/src/core/lib/iomgr/tcp_custom.cc +4 -1
- data/src/core/lib/iomgr/tcp_posix.cc +95 -35
- data/src/core/lib/iomgr/tcp_windows.cc +4 -1
- data/src/core/lib/iomgr/timer_manager.cc +6 -0
- data/src/core/lib/security/context/security_context.cc +75 -108
- data/src/core/lib/security/context/security_context.h +59 -35
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +36 -48
- data/src/core/lib/security/credentials/alts/alts_credentials.h +37 -10
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +97 -157
- data/src/core/lib/security/credentials/composite/composite_credentials.h +60 -24
- data/src/core/lib/security/credentials/credentials.cc +18 -142
- data/src/core/lib/security/credentials/credentials.h +119 -95
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +46 -71
- data/src/core/lib/security/credentials/fake/fake_credentials.h +23 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +144 -51
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +28 -5
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +27 -35
- data/src/core/lib/security/credentials/iam/iam_credentials.h +18 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +60 -69
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +29 -10
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/local/local_credentials.cc +19 -32
- data/src/core/lib/security/credentials/local/local_credentials.h +32 -11
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +130 -149
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +74 -29
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +59 -77
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +40 -17
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +66 -83
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +58 -15
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +152 -177
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +12 -10
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +210 -215
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +9 -6
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +176 -169
- data/src/core/lib/security/security_connector/local/local_security_connector.h +10 -9
- data/src/core/lib/security/security_connector/security_connector.cc +41 -124
- data/src/core/lib/security/security_connector/security_connector.h +102 -105
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +348 -370
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +14 -12
- data/src/core/lib/security/security_connector/ssl_utils.cc +13 -9
- data/src/core/lib/security/security_connector/ssl_utils.h +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +50 -50
- data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
- data/src/core/lib/security/transport/security_handshaker.cc +82 -66
- data/src/core/lib/security/transport/server_auth_filter.cc +15 -13
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/server.cc +13 -11
- data/src/core/lib/surface/server.h +6 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +1 -0
- data/src/core/lib/transport/static_metadata.cc +228 -221
- data/src/core/lib/transport/static_metadata.h +75 -71
- data/src/core/lib/transport/transport.cc +2 -1
- data/src/core/lib/transport/transport.h +5 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +9 -2
- data/src/core/tsi/ssl_transport_security.cc +35 -24
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +61 -0
- data/src/ruby/lib/grpc/generic/service.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +2 -3
- data/src/ruby/spec/generic/rpc_server_spec.rb +22 -0
- data/src/ruby/spec/support/services.rb +1 -0
- metadata +37 -32
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +0 -163
@@ -95,7 +95,7 @@ module GRPC
|
|
95
95
|
rpc_descs[name] = RpcDesc.new(name, input, output,
|
96
96
|
marshal_class_method,
|
97
97
|
unmarshal_class_method)
|
98
|
-
define_method(GenericService.underscore(name.to_s).to_sym) do
|
98
|
+
define_method(GenericService.underscore(name.to_s).to_sym) do |*|
|
99
99
|
fail GRPC::BadStatus.new_status_exception(
|
100
100
|
GRPC::Core::StatusCodes::UNIMPLEMENTED)
|
101
101
|
end
|
@@ -14,7 +14,6 @@
|
|
14
14
|
|
15
15
|
require 'grpc'
|
16
16
|
require 'grpc/health/v1/health_services_pb'
|
17
|
-
require 'thread'
|
18
17
|
|
19
18
|
module Grpc
|
20
19
|
# Health contains classes and modules that support providing a health check
|
@@ -37,9 +36,9 @@ module Grpc
|
|
37
36
|
@status_mutex.synchronize do
|
38
37
|
status = @statuses["#{req.service}"]
|
39
38
|
end
|
40
|
-
|
39
|
+
if status.nil?
|
41
40
|
fail GRPC::BadStatus.new_status_exception(StatusCodes::NOT_FOUND)
|
42
|
-
|
41
|
+
end
|
43
42
|
HealthCheckResponse.new(status: status)
|
44
43
|
end
|
45
44
|
|
@@ -342,6 +342,28 @@ describe GRPC::RpcServer do
|
|
342
342
|
t.join
|
343
343
|
end
|
344
344
|
|
345
|
+
it 'should return UNIMPLEMENTED on unimplemented ' \
|
346
|
+
'methods for client_streamer', server: true do
|
347
|
+
@srv.handle(EchoService)
|
348
|
+
t = Thread.new { @srv.run }
|
349
|
+
@srv.wait_till_running
|
350
|
+
blk = proc do
|
351
|
+
stub = EchoStub.new(@host, :this_channel_is_insecure, **client_opts)
|
352
|
+
requests = [EchoMsg.new, EchoMsg.new]
|
353
|
+
stub.a_client_streaming_rpc_unimplemented(requests)
|
354
|
+
end
|
355
|
+
|
356
|
+
begin
|
357
|
+
expect(&blk).to raise_error do |error|
|
358
|
+
expect(error).to be_a(GRPC::BadStatus)
|
359
|
+
expect(error.code).to eq(GRPC::Core::StatusCodes::UNIMPLEMENTED)
|
360
|
+
end
|
361
|
+
ensure
|
362
|
+
@srv.stop # should be call not to crash
|
363
|
+
t.join
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
345
367
|
it 'should handle multiple sequential requests', server: true do
|
346
368
|
@srv.handle(EchoService)
|
347
369
|
t = Thread.new { @srv.run }
|
@@ -33,6 +33,7 @@ class EchoService
|
|
33
33
|
rpc :a_client_streaming_rpc, stream(EchoMsg), EchoMsg
|
34
34
|
rpc :a_server_streaming_rpc, EchoMsg, stream(EchoMsg)
|
35
35
|
rpc :a_bidi_rpc, stream(EchoMsg), stream(EchoMsg)
|
36
|
+
rpc :a_client_streaming_rpc_unimplemented, stream(EchoMsg), EchoMsg
|
36
37
|
attr_reader :received_md
|
37
38
|
|
38
39
|
def initialize(**kw)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gRPC Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: src/ruby/bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -314,7 +314,6 @@ files:
|
|
314
314
|
- src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h
|
315
315
|
- src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc
|
316
316
|
- src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h
|
317
|
-
- src/core/ext/filters/client_channel/lb_policy_factory.cc
|
318
317
|
- src/core/ext/filters/client_channel/lb_policy_factory.h
|
319
318
|
- src/core/ext/filters/client_channel/lb_policy_registry.cc
|
320
319
|
- src/core/ext/filters/client_channel/lb_policy_registry.h
|
@@ -324,6 +323,8 @@ files:
|
|
324
323
|
- src/core/ext/filters/client_channel/proxy_mapper.h
|
325
324
|
- src/core/ext/filters/client_channel/proxy_mapper_registry.cc
|
326
325
|
- src/core/ext/filters/client_channel/proxy_mapper_registry.h
|
326
|
+
- src/core/ext/filters/client_channel/request_routing.cc
|
327
|
+
- src/core/ext/filters/client_channel/request_routing.h
|
327
328
|
- src/core/ext/filters/client_channel/resolver.cc
|
328
329
|
- src/core/ext/filters/client_channel/resolver.h
|
329
330
|
- src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
|
@@ -347,6 +348,8 @@ files:
|
|
347
348
|
- src/core/ext/filters/client_channel/resolver_result_parsing.h
|
348
349
|
- src/core/ext/filters/client_channel/retry_throttle.cc
|
349
350
|
- src/core/ext/filters/client_channel/retry_throttle.h
|
351
|
+
- src/core/ext/filters/client_channel/server_address.cc
|
352
|
+
- src/core/ext/filters/client_channel/server_address.h
|
350
353
|
- src/core/ext/filters/client_channel/subchannel.cc
|
351
354
|
- src/core/ext/filters/client_channel/subchannel.h
|
352
355
|
- src/core/ext/filters/client_channel/subchannel_index.cc
|
@@ -391,6 +394,8 @@ files:
|
|
391
394
|
- src/core/ext/transport/chttp2/transport/chttp2_plugin.cc
|
392
395
|
- src/core/ext/transport/chttp2/transport/chttp2_transport.cc
|
393
396
|
- src/core/ext/transport/chttp2/transport/chttp2_transport.h
|
397
|
+
- src/core/ext/transport/chttp2/transport/context_list.cc
|
398
|
+
- src/core/ext/transport/chttp2/transport/context_list.h
|
394
399
|
- src/core/ext/transport/chttp2/transport/flow_control.cc
|
395
400
|
- src/core/ext/transport/chttp2/transport/flow_control.h
|
396
401
|
- src/core/ext/transport/chttp2/transport/frame.h
|
@@ -556,6 +561,7 @@ files:
|
|
556
561
|
- src/core/lib/iomgr/closure.h
|
557
562
|
- src/core/lib/iomgr/combiner.cc
|
558
563
|
- src/core/lib/iomgr/combiner.h
|
564
|
+
- src/core/lib/iomgr/dynamic_annotations.h
|
559
565
|
- src/core/lib/iomgr/endpoint.cc
|
560
566
|
- src/core/lib/iomgr/endpoint.h
|
561
567
|
- src/core/lib/iomgr/endpoint_pair.h
|
@@ -1576,48 +1582,47 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1576
1582
|
version: 2.0.0
|
1577
1583
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1578
1584
|
requirements:
|
1579
|
-
- - "
|
1585
|
+
- - ">"
|
1580
1586
|
- !ruby/object:Gem::Version
|
1581
|
-
version:
|
1587
|
+
version: 1.3.1
|
1582
1588
|
requirements: []
|
1583
|
-
|
1584
|
-
rubygems_version: 2.7.8
|
1589
|
+
rubygems_version: 3.0.2
|
1585
1590
|
signing_key:
|
1586
1591
|
specification_version: 4
|
1587
1592
|
summary: GRPC system in Ruby
|
1588
1593
|
test_files:
|
1589
|
-
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1590
|
-
- src/ruby/spec/channel_spec.rb
|
1591
|
-
- src/ruby/spec/compression_options_spec.rb
|
1592
|
-
- src/ruby/spec/time_consts_spec.rb
|
1593
|
-
- src/ruby/spec/spec_helper.rb
|
1594
|
-
- src/ruby/spec/client_server_spec.rb
|
1595
|
-
- src/ruby/spec/generic/rpc_server_pool_spec.rb
|
1596
|
-
- src/ruby/spec/generic/interceptor_registry_spec.rb
|
1597
|
-
- src/ruby/spec/generic/rpc_desc_spec.rb
|
1598
|
-
- src/ruby/spec/generic/active_call_spec.rb
|
1599
|
-
- src/ruby/spec/generic/client_interceptors_spec.rb
|
1600
|
-
- src/ruby/spec/generic/server_interceptors_spec.rb
|
1601
|
-
- src/ruby/spec/generic/rpc_server_spec.rb
|
1602
|
-
- src/ruby/spec/generic/client_stub_spec.rb
|
1603
|
-
- src/ruby/spec/generic/service_spec.rb
|
1604
|
-
- src/ruby/spec/support/services.rb
|
1605
|
-
- src/ruby/spec/support/helpers.rb
|
1606
|
-
- src/ruby/spec/server_spec.rb
|
1607
1594
|
- src/ruby/spec/client_auth_spec.rb
|
1608
|
-
- src/ruby/spec/
|
1609
|
-
- src/ruby/spec/
|
1595
|
+
- src/ruby/spec/support/helpers.rb
|
1596
|
+
- src/ruby/spec/support/services.rb
|
1597
|
+
- src/ruby/spec/call_spec.rb
|
1610
1598
|
- src/ruby/spec/channel_connection_spec.rb
|
1611
|
-
- src/ruby/spec/
|
1612
|
-
- src/ruby/spec/
|
1599
|
+
- src/ruby/spec/time_consts_spec.rb
|
1600
|
+
- src/ruby/spec/server_credentials_spec.rb
|
1601
|
+
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1613
1602
|
- src/ruby/spec/pb/duplicate/codegen_spec.rb
|
1603
|
+
- src/ruby/spec/pb/codegen/package_option_spec.rb
|
1604
|
+
- src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
|
1614
1605
|
- src/ruby/spec/pb/health/checker_spec.rb
|
1615
1606
|
- src/ruby/spec/error_sanity_spec.rb
|
1616
1607
|
- src/ruby/spec/call_credentials_spec.rb
|
1617
|
-
- src/ruby/spec/
|
1608
|
+
- src/ruby/spec/compression_options_spec.rb
|
1609
|
+
- src/ruby/spec/channel_credentials_spec.rb
|
1610
|
+
- src/ruby/spec/channel_spec.rb
|
1611
|
+
- src/ruby/spec/client_server_spec.rb
|
1618
1612
|
- src/ruby/spec/testdata/README
|
1619
|
-
- src/ruby/spec/testdata/ca.pem
|
1620
1613
|
- src/ruby/spec/testdata/server1.key
|
1621
|
-
- src/ruby/spec/testdata/client.pem
|
1622
1614
|
- src/ruby/spec/testdata/client.key
|
1623
1615
|
- src/ruby/spec/testdata/server1.pem
|
1616
|
+
- src/ruby/spec/testdata/ca.pem
|
1617
|
+
- src/ruby/spec/testdata/client.pem
|
1618
|
+
- src/ruby/spec/server_spec.rb
|
1619
|
+
- src/ruby/spec/spec_helper.rb
|
1620
|
+
- src/ruby/spec/generic/service_spec.rb
|
1621
|
+
- src/ruby/spec/generic/client_interceptors_spec.rb
|
1622
|
+
- src/ruby/spec/generic/active_call_spec.rb
|
1623
|
+
- src/ruby/spec/generic/rpc_desc_spec.rb
|
1624
|
+
- src/ruby/spec/generic/client_stub_spec.rb
|
1625
|
+
- src/ruby/spec/generic/server_interceptors_spec.rb
|
1626
|
+
- src/ruby/spec/generic/interceptor_registry_spec.rb
|
1627
|
+
- src/ruby/spec/generic/rpc_server_spec.rb
|
1628
|
+
- src/ruby/spec/generic/rpc_server_pool_spec.rb
|
@@ -1,163 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
*
|
3
|
-
* Copyright 2015 gRPC authors.
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
*/
|
18
|
-
|
19
|
-
#include <grpc/support/port_platform.h>
|
20
|
-
|
21
|
-
#include <string.h>
|
22
|
-
|
23
|
-
#include <grpc/support/alloc.h>
|
24
|
-
#include <grpc/support/string_util.h>
|
25
|
-
|
26
|
-
#include "src/core/lib/channel/channel_args.h"
|
27
|
-
|
28
|
-
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
29
|
-
#include "src/core/ext/filters/client_channel/parse_address.h"
|
30
|
-
|
31
|
-
grpc_lb_addresses* grpc_lb_addresses_create(
|
32
|
-
size_t num_addresses, const grpc_lb_user_data_vtable* user_data_vtable) {
|
33
|
-
grpc_lb_addresses* addresses =
|
34
|
-
static_cast<grpc_lb_addresses*>(gpr_zalloc(sizeof(grpc_lb_addresses)));
|
35
|
-
addresses->num_addresses = num_addresses;
|
36
|
-
addresses->user_data_vtable = user_data_vtable;
|
37
|
-
const size_t addresses_size = sizeof(grpc_lb_address) * num_addresses;
|
38
|
-
addresses->addresses =
|
39
|
-
static_cast<grpc_lb_address*>(gpr_zalloc(addresses_size));
|
40
|
-
return addresses;
|
41
|
-
}
|
42
|
-
|
43
|
-
grpc_lb_addresses* grpc_lb_addresses_copy(const grpc_lb_addresses* addresses) {
|
44
|
-
grpc_lb_addresses* new_addresses = grpc_lb_addresses_create(
|
45
|
-
addresses->num_addresses, addresses->user_data_vtable);
|
46
|
-
memcpy(new_addresses->addresses, addresses->addresses,
|
47
|
-
sizeof(grpc_lb_address) * addresses->num_addresses);
|
48
|
-
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
49
|
-
if (new_addresses->addresses[i].balancer_name != nullptr) {
|
50
|
-
new_addresses->addresses[i].balancer_name =
|
51
|
-
gpr_strdup(new_addresses->addresses[i].balancer_name);
|
52
|
-
}
|
53
|
-
if (new_addresses->addresses[i].user_data != nullptr) {
|
54
|
-
new_addresses->addresses[i].user_data = addresses->user_data_vtable->copy(
|
55
|
-
new_addresses->addresses[i].user_data);
|
56
|
-
}
|
57
|
-
}
|
58
|
-
return new_addresses;
|
59
|
-
}
|
60
|
-
|
61
|
-
void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index,
|
62
|
-
const void* address, size_t address_len,
|
63
|
-
bool is_balancer, const char* balancer_name,
|
64
|
-
void* user_data) {
|
65
|
-
GPR_ASSERT(index < addresses->num_addresses);
|
66
|
-
if (user_data != nullptr) GPR_ASSERT(addresses->user_data_vtable != nullptr);
|
67
|
-
grpc_lb_address* target = &addresses->addresses[index];
|
68
|
-
memcpy(target->address.addr, address, address_len);
|
69
|
-
target->address.len = static_cast<socklen_t>(address_len);
|
70
|
-
target->is_balancer = is_balancer;
|
71
|
-
target->balancer_name = gpr_strdup(balancer_name);
|
72
|
-
target->user_data = user_data;
|
73
|
-
}
|
74
|
-
|
75
|
-
bool grpc_lb_addresses_set_address_from_uri(grpc_lb_addresses* addresses,
|
76
|
-
size_t index, const grpc_uri* uri,
|
77
|
-
bool is_balancer,
|
78
|
-
const char* balancer_name,
|
79
|
-
void* user_data) {
|
80
|
-
grpc_resolved_address address;
|
81
|
-
if (!grpc_parse_uri(uri, &address)) return false;
|
82
|
-
grpc_lb_addresses_set_address(addresses, index, address.addr, address.len,
|
83
|
-
is_balancer, balancer_name, user_data);
|
84
|
-
return true;
|
85
|
-
}
|
86
|
-
|
87
|
-
int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1,
|
88
|
-
const grpc_lb_addresses* addresses2) {
|
89
|
-
if (addresses1->num_addresses > addresses2->num_addresses) return 1;
|
90
|
-
if (addresses1->num_addresses < addresses2->num_addresses) return -1;
|
91
|
-
if (addresses1->user_data_vtable > addresses2->user_data_vtable) return 1;
|
92
|
-
if (addresses1->user_data_vtable < addresses2->user_data_vtable) return -1;
|
93
|
-
for (size_t i = 0; i < addresses1->num_addresses; ++i) {
|
94
|
-
const grpc_lb_address* target1 = &addresses1->addresses[i];
|
95
|
-
const grpc_lb_address* target2 = &addresses2->addresses[i];
|
96
|
-
if (target1->address.len > target2->address.len) return 1;
|
97
|
-
if (target1->address.len < target2->address.len) return -1;
|
98
|
-
int retval = memcmp(target1->address.addr, target2->address.addr,
|
99
|
-
target1->address.len);
|
100
|
-
if (retval != 0) return retval;
|
101
|
-
if (target1->is_balancer > target2->is_balancer) return 1;
|
102
|
-
if (target1->is_balancer < target2->is_balancer) return -1;
|
103
|
-
const char* balancer_name1 =
|
104
|
-
target1->balancer_name != nullptr ? target1->balancer_name : "";
|
105
|
-
const char* balancer_name2 =
|
106
|
-
target2->balancer_name != nullptr ? target2->balancer_name : "";
|
107
|
-
retval = strcmp(balancer_name1, balancer_name2);
|
108
|
-
if (retval != 0) return retval;
|
109
|
-
if (addresses1->user_data_vtable != nullptr) {
|
110
|
-
retval = addresses1->user_data_vtable->cmp(target1->user_data,
|
111
|
-
target2->user_data);
|
112
|
-
if (retval != 0) return retval;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
return 0;
|
116
|
-
}
|
117
|
-
|
118
|
-
void grpc_lb_addresses_destroy(grpc_lb_addresses* addresses) {
|
119
|
-
for (size_t i = 0; i < addresses->num_addresses; ++i) {
|
120
|
-
gpr_free(addresses->addresses[i].balancer_name);
|
121
|
-
if (addresses->addresses[i].user_data != nullptr) {
|
122
|
-
addresses->user_data_vtable->destroy(addresses->addresses[i].user_data);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
gpr_free(addresses->addresses);
|
126
|
-
gpr_free(addresses);
|
127
|
-
}
|
128
|
-
|
129
|
-
static void* lb_addresses_copy(void* addresses) {
|
130
|
-
return grpc_lb_addresses_copy(static_cast<grpc_lb_addresses*>(addresses));
|
131
|
-
}
|
132
|
-
static void lb_addresses_destroy(void* addresses) {
|
133
|
-
grpc_lb_addresses_destroy(static_cast<grpc_lb_addresses*>(addresses));
|
134
|
-
}
|
135
|
-
static int lb_addresses_cmp(void* addresses1, void* addresses2) {
|
136
|
-
return grpc_lb_addresses_cmp(static_cast<grpc_lb_addresses*>(addresses1),
|
137
|
-
static_cast<grpc_lb_addresses*>(addresses2));
|
138
|
-
}
|
139
|
-
static const grpc_arg_pointer_vtable lb_addresses_arg_vtable = {
|
140
|
-
lb_addresses_copy, lb_addresses_destroy, lb_addresses_cmp};
|
141
|
-
|
142
|
-
grpc_arg grpc_lb_addresses_create_channel_arg(
|
143
|
-
const grpc_lb_addresses* addresses) {
|
144
|
-
return grpc_channel_arg_pointer_create(
|
145
|
-
(char*)GRPC_ARG_LB_ADDRESSES, (void*)addresses, &lb_addresses_arg_vtable);
|
146
|
-
}
|
147
|
-
|
148
|
-
grpc_lb_addresses* grpc_lb_addresses_find_channel_arg(
|
149
|
-
const grpc_channel_args* channel_args) {
|
150
|
-
const grpc_arg* lb_addresses_arg =
|
151
|
-
grpc_channel_args_find(channel_args, GRPC_ARG_LB_ADDRESSES);
|
152
|
-
if (lb_addresses_arg == nullptr || lb_addresses_arg->type != GRPC_ARG_POINTER)
|
153
|
-
return nullptr;
|
154
|
-
return static_cast<grpc_lb_addresses*>(lb_addresses_arg->value.pointer.p);
|
155
|
-
}
|
156
|
-
|
157
|
-
bool grpc_lb_addresses_contains_balancer_address(
|
158
|
-
const grpc_lb_addresses& addresses) {
|
159
|
-
for (size_t i = 0; i < addresses.num_addresses; ++i) {
|
160
|
-
if (addresses.addresses[i].is_balancer) return true;
|
161
|
-
}
|
162
|
-
return false;
|
163
|
-
}
|