grpc 1.18.0 → 1.19.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 +301 -33
- data/include/grpc/grpc_security.h +195 -0
- data/include/grpc/impl/codegen/grpc_types.h +17 -1
- data/include/grpc/impl/codegen/port_platform.h +36 -0
- data/include/grpc/impl/codegen/slice.h +1 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +74 -69
- data/src/core/ext/filters/client_channel/client_channel.h +2 -2
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +5 -6
- data/src/core/ext/filters/client_channel/client_channel_channelz.h +5 -4
- data/src/core/ext/filters/client_channel/client_channel_factory.cc +2 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.h +4 -4
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +3 -3
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +176 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +68 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +10 -8
- data/src/core/ext/filters/client_channel/health/health_check_client.h +1 -1
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +146 -156
- data/src/core/ext/filters/client_channel/lb_policy.cc +30 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +29 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +28 -30
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +5 -8
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +5 -8
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +23 -24
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +80 -15
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +6 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -1
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +96 -0
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +56 -0
- data/src/core/ext/filters/client_channel/parse_address.cc +24 -5
- data/src/core/ext/filters/client_channel/request_routing.cc +13 -3
- data/src/core/ext/filters/client_channel/request_routing.h +5 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +11 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +7 -35
- data/src/core/ext/filters/client_channel/subchannel.cc +698 -791
- data/src/core/ext/filters/client_channel/subchannel.h +213 -123
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +97 -0
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +94 -0
- data/src/core/ext/filters/http/client_authority_filter.cc +5 -2
- data/src/core/ext/filters/max_age/max_age_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +13 -12
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +5 -7
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +19 -27
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +18 -19
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +27 -6
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/writing.cc +8 -5
- data/src/core/lib/channel/handshaker.cc +141 -214
- data/src/core/lib/channel/handshaker.h +110 -101
- data/src/core/lib/channel/handshaker_factory.h +11 -19
- data/src/core/lib/channel/handshaker_registry.cc +64 -52
- data/src/core/lib/channel/handshaker_registry.h +21 -16
- data/src/core/lib/gpr/log_posix.cc +2 -1
- data/src/core/lib/gpr/time.cc +8 -0
- data/src/core/lib/gpr/time_posix.cc +8 -2
- data/src/core/lib/gprpp/optional.h +47 -0
- data/src/core/lib/http/httpcli_security_connector.cc +13 -14
- data/src/core/lib/iomgr/buffer_list.cc +182 -24
- data/src/core/lib/iomgr/buffer_list.h +70 -8
- data/src/core/lib/iomgr/combiner.cc +11 -3
- data/src/core/lib/iomgr/error.cc +9 -5
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +136 -162
- data/src/core/lib/iomgr/ev_poll_posix.cc +3 -0
- data/src/core/lib/iomgr/ev_posix.cc +4 -0
- data/src/core/lib/iomgr/ev_posix.h +4 -0
- data/src/core/lib/iomgr/exec_ctx.cc +1 -0
- data/src/core/lib/iomgr/exec_ctx.h +137 -8
- data/src/core/lib/iomgr/executor.cc +122 -87
- data/src/core/lib/iomgr/executor.h +53 -48
- data/src/core/lib/iomgr/fork_posix.cc +6 -4
- data/src/core/lib/iomgr/{network_status_tracker.cc → grpc_if_nametoindex.h} +8 -14
- data/src/core/lib/iomgr/grpc_if_nametoindex_posix.cc +42 -0
- data/src/core/lib/iomgr/{network_status_tracker.h → grpc_if_nametoindex_unsupported.cc} +15 -9
- data/src/core/lib/iomgr/internal_errqueue.h +105 -3
- data/src/core/lib/iomgr/iomgr.cc +6 -5
- data/src/core/lib/iomgr/iomgr.h +8 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +6 -2
- 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 +10 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +8 -1
- data/src/core/lib/iomgr/port.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +4 -3
- data/src/core/lib/iomgr/resolve_address_windows.cc +2 -1
- data/src/core/lib/iomgr/tcp_custom.cc +0 -4
- data/src/core/lib/iomgr/tcp_posix.cc +58 -44
- data/src/core/lib/iomgr/tcp_uv.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +0 -4
- data/src/core/lib/iomgr/timer_manager.cc +8 -0
- data/src/core/lib/iomgr/udp_server.cc +6 -4
- data/src/core/lib/json/json.cc +1 -4
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +1 -1
- data/src/core/lib/security/credentials/alts/check_gcp_environment_no_op.cc +2 -2
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -0
- data/src/core/lib/security/credentials/credentials.h +9 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +15 -2
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +2 -0
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -0
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +2 -2
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +192 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +213 -0
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +6 -10
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +10 -8
- data/src/core/lib/security/security_connector/security_connector.h +2 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -6
- data/src/core/lib/security/security_connector/ssl_utils.h +33 -0
- data/src/core/lib/security/transport/security_handshaker.cc +267 -300
- data/src/core/lib/security/transport/security_handshaker.h +11 -2
- data/src/core/lib/security/transport/server_auth_filter.cc +1 -0
- data/src/core/lib/surface/call.cc +5 -1
- data/src/core/lib/surface/channel_init.h +5 -0
- data/src/core/lib/surface/completion_queue.cc +4 -7
- data/src/core/lib/surface/init.cc +5 -3
- data/src/core/lib/surface/init_secure.cc +1 -1
- data/src/core/lib/surface/server.cc +19 -17
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/service_config.h +1 -0
- data/src/core/lib/transport/static_metadata.cc +279 -279
- data/src/core/lib/transport/transport.cc +5 -3
- data/src/core/tsi/ssl_transport_security.cc +10 -4
- data/src/ruby/ext/grpc/extconf.rb +12 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +8 -5
- data/src/ruby/ext/grpc/rb_channel.c +14 -10
- data/src/ruby/ext/grpc/rb_channel_credentials.c +8 -4
- data/src/ruby/ext/grpc/rb_compression_options.c +9 -7
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc.c +22 -23
- data/src/ruby/ext/grpc/rb_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +18 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +27 -0
- data/src/ruby/ext/grpc/rb_server.c +8 -4
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +46 -39
- data/src/core/ext/filters/client_channel/subchannel_index.cc +0 -248
- data/src/core/ext/filters/client_channel/subchannel_index.h +0 -76
- data/src/core/lib/channel/handshaker_factory.cc +0 -42
@@ -86,8 +86,7 @@ static void grpc_rb_server_maybe_destroy(grpc_rb_server* server) {
|
|
86
86
|
}
|
87
87
|
}
|
88
88
|
|
89
|
-
|
90
|
-
static void grpc_rb_server_free(void* p) {
|
89
|
+
static void grpc_rb_server_free_internal(void* p) {
|
91
90
|
grpc_rb_server* svr = NULL;
|
92
91
|
gpr_timespec deadline;
|
93
92
|
if (p == NULL) {
|
@@ -104,6 +103,12 @@ static void grpc_rb_server_free(void* p) {
|
|
104
103
|
xfree(p);
|
105
104
|
}
|
106
105
|
|
106
|
+
/* Destroys server instances. */
|
107
|
+
static void grpc_rb_server_free(void* p) {
|
108
|
+
grpc_rb_server_free_internal(p);
|
109
|
+
grpc_ruby_shutdown();
|
110
|
+
}
|
111
|
+
|
107
112
|
static const rb_data_type_t grpc_rb_server_data_type = {
|
108
113
|
"grpc_server",
|
109
114
|
{GRPC_RB_GC_NOT_MARKED,
|
@@ -123,6 +128,7 @@ static const rb_data_type_t grpc_rb_server_data_type = {
|
|
123
128
|
|
124
129
|
/* Allocates grpc_rb_server instances. */
|
125
130
|
static VALUE grpc_rb_server_alloc(VALUE cls) {
|
131
|
+
grpc_ruby_init();
|
126
132
|
grpc_rb_server* wrapper = ALLOC(grpc_rb_server);
|
127
133
|
wrapper->wrapped = NULL;
|
128
134
|
wrapper->destroy_done = 0;
|
@@ -142,8 +148,6 @@ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) {
|
|
142
148
|
grpc_channel_args args;
|
143
149
|
MEMZERO(&args, grpc_channel_args, 1);
|
144
150
|
|
145
|
-
grpc_ruby_once_init();
|
146
|
-
|
147
151
|
cq = grpc_completion_queue_create_for_pluck(NULL);
|
148
152
|
TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type,
|
149
153
|
wrapper);
|
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.19.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: 2019-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-protobuf
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.7
|
173
|
+
version: '0.7'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.7
|
180
|
+
version: '0.7'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: googleauth
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,7 +187,7 @@ dependencies:
|
|
187
187
|
version: 0.5.1
|
188
188
|
- - "<"
|
189
189
|
- !ruby/object:Gem::Version
|
190
|
-
version: '0.
|
190
|
+
version: '0.10'
|
191
191
|
type: :development
|
192
192
|
prerelease: false
|
193
193
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ dependencies:
|
|
197
197
|
version: 0.5.1
|
198
198
|
- - "<"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0.
|
200
|
+
version: '0.10'
|
201
201
|
description: Send RPCs from Ruby using GRPC
|
202
202
|
email: temiola@google.com
|
203
203
|
executables: []
|
@@ -277,6 +277,8 @@ files:
|
|
277
277
|
- src/core/ext/filters/client_channel/client_channel_plugin.cc
|
278
278
|
- src/core/ext/filters/client_channel/connector.cc
|
279
279
|
- src/core/ext/filters/client_channel/connector.h
|
280
|
+
- src/core/ext/filters/client_channel/global_subchannel_pool.cc
|
281
|
+
- src/core/ext/filters/client_channel/global_subchannel_pool.h
|
280
282
|
- src/core/ext/filters/client_channel/health/health.pb.c
|
281
283
|
- src/core/ext/filters/client_channel/health/health.pb.h
|
282
284
|
- src/core/ext/filters/client_channel/health/health_check_client.cc
|
@@ -317,6 +319,8 @@ files:
|
|
317
319
|
- src/core/ext/filters/client_channel/lb_policy_factory.h
|
318
320
|
- src/core/ext/filters/client_channel/lb_policy_registry.cc
|
319
321
|
- src/core/ext/filters/client_channel/lb_policy_registry.h
|
322
|
+
- src/core/ext/filters/client_channel/local_subchannel_pool.cc
|
323
|
+
- src/core/ext/filters/client_channel/local_subchannel_pool.h
|
320
324
|
- src/core/ext/filters/client_channel/parse_address.cc
|
321
325
|
- src/core/ext/filters/client_channel/parse_address.h
|
322
326
|
- src/core/ext/filters/client_channel/proxy_mapper.cc
|
@@ -352,8 +356,8 @@ files:
|
|
352
356
|
- src/core/ext/filters/client_channel/server_address.h
|
353
357
|
- src/core/ext/filters/client_channel/subchannel.cc
|
354
358
|
- src/core/ext/filters/client_channel/subchannel.h
|
355
|
-
- src/core/ext/filters/client_channel/
|
356
|
-
- src/core/ext/filters/client_channel/
|
359
|
+
- src/core/ext/filters/client_channel/subchannel_pool_interface.cc
|
360
|
+
- src/core/ext/filters/client_channel/subchannel_pool_interface.h
|
357
361
|
- src/core/ext/filters/deadline/deadline_filter.cc
|
358
362
|
- src/core/ext/filters/deadline/deadline_filter.h
|
359
363
|
- src/core/ext/filters/http/client/http_client_filter.cc
|
@@ -455,7 +459,6 @@ files:
|
|
455
459
|
- src/core/lib/channel/context.h
|
456
460
|
- src/core/lib/channel/handshaker.cc
|
457
461
|
- src/core/lib/channel/handshaker.h
|
458
|
-
- src/core/lib/channel/handshaker_factory.cc
|
459
462
|
- src/core/lib/channel/handshaker_factory.h
|
460
463
|
- src/core/lib/channel/handshaker_registry.cc
|
461
464
|
- src/core/lib/channel/handshaker_registry.h
|
@@ -540,6 +543,7 @@ files:
|
|
540
543
|
- src/core/lib/gprpp/manual_constructor.h
|
541
544
|
- src/core/lib/gprpp/memory.h
|
542
545
|
- src/core/lib/gprpp/mutex_lock.h
|
546
|
+
- src/core/lib/gprpp/optional.h
|
543
547
|
- src/core/lib/gprpp/orphanable.h
|
544
548
|
- src/core/lib/gprpp/ref_counted.h
|
545
549
|
- src/core/lib/gprpp/ref_counted_ptr.h
|
@@ -590,6 +594,9 @@ files:
|
|
590
594
|
- src/core/lib/iomgr/gethostname_fallback.cc
|
591
595
|
- src/core/lib/iomgr/gethostname_host_name_max.cc
|
592
596
|
- src/core/lib/iomgr/gethostname_sysconf.cc
|
597
|
+
- src/core/lib/iomgr/grpc_if_nametoindex.h
|
598
|
+
- src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
|
599
|
+
- src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
|
593
600
|
- src/core/lib/iomgr/internal_errqueue.cc
|
594
601
|
- src/core/lib/iomgr/internal_errqueue.h
|
595
602
|
- src/core/lib/iomgr/iocp_windows.cc
|
@@ -611,8 +618,6 @@ files:
|
|
611
618
|
- src/core/lib/iomgr/lockfree_event.cc
|
612
619
|
- src/core/lib/iomgr/lockfree_event.h
|
613
620
|
- src/core/lib/iomgr/nameser.h
|
614
|
-
- src/core/lib/iomgr/network_status_tracker.cc
|
615
|
-
- src/core/lib/iomgr/network_status_tracker.h
|
616
621
|
- src/core/lib/iomgr/polling_entity.cc
|
617
622
|
- src/core/lib/iomgr/polling_entity.h
|
618
623
|
- src/core/lib/iomgr/pollset.cc
|
@@ -754,6 +759,8 @@ files:
|
|
754
759
|
- src/core/lib/security/credentials/plugin/plugin_credentials.h
|
755
760
|
- src/core/lib/security/credentials/ssl/ssl_credentials.cc
|
756
761
|
- src/core/lib/security/credentials/ssl/ssl_credentials.h
|
762
|
+
- src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc
|
763
|
+
- src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h
|
757
764
|
- src/core/lib/security/security_connector/alts/alts_security_connector.cc
|
758
765
|
- src/core/lib/security/security_connector/alts/alts_security_connector.h
|
759
766
|
- src/core/lib/security/security_connector/fake/fake_security_connector.cc
|
@@ -1582,47 +1589,47 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1582
1589
|
version: 2.0.0
|
1583
1590
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1584
1591
|
requirements:
|
1585
|
-
- - "
|
1592
|
+
- - ">"
|
1586
1593
|
- !ruby/object:Gem::Version
|
1587
|
-
version:
|
1594
|
+
version: 1.3.1
|
1588
1595
|
requirements: []
|
1589
1596
|
rubygems_version: 3.0.2
|
1590
1597
|
signing_key:
|
1591
1598
|
specification_version: 4
|
1592
1599
|
summary: GRPC system in Ruby
|
1593
1600
|
test_files:
|
1594
|
-
- src/ruby/spec/
|
1595
|
-
- src/ruby/spec/
|
1596
|
-
- src/ruby/spec/
|
1597
|
-
- src/ruby/spec/pb/health/checker_spec.rb
|
1598
|
-
- src/ruby/spec/time_consts_spec.rb
|
1599
|
-
- src/ruby/spec/channel_connection_spec.rb
|
1600
|
-
- src/ruby/spec/compression_options_spec.rb
|
1601
|
-
- src/ruby/spec/call_credentials_spec.rb
|
1602
|
-
- src/ruby/spec/client_auth_spec.rb
|
1603
|
-
- src/ruby/spec/client_server_spec.rb
|
1604
|
-
- src/ruby/spec/testdata/README
|
1601
|
+
- src/ruby/spec/server_spec.rb
|
1602
|
+
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1603
|
+
- src/ruby/spec/testdata/server1.pem
|
1605
1604
|
- src/ruby/spec/testdata/server1.key
|
1605
|
+
- src/ruby/spec/testdata/client.pem
|
1606
1606
|
- src/ruby/spec/testdata/client.key
|
1607
|
-
- src/ruby/spec/testdata/
|
1607
|
+
- src/ruby/spec/testdata/README
|
1608
1608
|
- src/ruby/spec/testdata/ca.pem
|
1609
|
-
- src/ruby/spec/
|
1610
|
-
- src/ruby/spec/
|
1611
|
-
- src/ruby/spec/
|
1612
|
-
- src/ruby/spec/channel_credentials_spec.rb
|
1613
|
-
- src/ruby/spec/server_spec.rb
|
1614
|
-
- src/ruby/spec/google_rpc_status_utils_spec.rb
|
1609
|
+
- src/ruby/spec/compression_options_spec.rb
|
1610
|
+
- src/ruby/spec/call_credentials_spec.rb
|
1611
|
+
- src/ruby/spec/client_auth_spec.rb
|
1615
1612
|
- src/ruby/spec/call_spec.rb
|
1616
|
-
- src/ruby/spec/
|
1617
|
-
- src/ruby/spec/spec_helper.rb
|
1613
|
+
- src/ruby/spec/channel_credentials_spec.rb
|
1618
1614
|
- src/ruby/spec/server_credentials_spec.rb
|
1619
|
-
- src/ruby/spec/
|
1615
|
+
- src/ruby/spec/generic/rpc_desc_spec.rb
|
1616
|
+
- src/ruby/spec/generic/service_spec.rb
|
1620
1617
|
- src/ruby/spec/generic/client_interceptors_spec.rb
|
1618
|
+
- src/ruby/spec/generic/rpc_server_spec.rb
|
1619
|
+
- src/ruby/spec/generic/server_interceptors_spec.rb
|
1620
|
+
- src/ruby/spec/generic/interceptor_registry_spec.rb
|
1621
1621
|
- src/ruby/spec/generic/client_stub_spec.rb
|
1622
1622
|
- src/ruby/spec/generic/active_call_spec.rb
|
1623
1623
|
- src/ruby/spec/generic/rpc_server_pool_spec.rb
|
1624
|
-
- src/ruby/spec/
|
1625
|
-
- src/ruby/spec/
|
1626
|
-
- src/ruby/spec/
|
1627
|
-
- src/ruby/spec/
|
1628
|
-
- src/ruby/spec/
|
1624
|
+
- src/ruby/spec/spec_helper.rb
|
1625
|
+
- src/ruby/spec/channel_connection_spec.rb
|
1626
|
+
- src/ruby/spec/channel_spec.rb
|
1627
|
+
- src/ruby/spec/error_sanity_spec.rb
|
1628
|
+
- src/ruby/spec/time_consts_spec.rb
|
1629
|
+
- src/ruby/spec/client_server_spec.rb
|
1630
|
+
- src/ruby/spec/support/services.rb
|
1631
|
+
- src/ruby/spec/support/helpers.rb
|
1632
|
+
- src/ruby/spec/pb/health/checker_spec.rb
|
1633
|
+
- src/ruby/spec/pb/codegen/package_option_spec.rb
|
1634
|
+
- src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
|
1635
|
+
- src/ruby/spec/pb/duplicate/codegen_spec.rb
|
@@ -1,248 +0,0 @@
|
|
1
|
-
//
|
2
|
-
//
|
3
|
-
// Copyright 2016 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 "src/core/ext/filters/client_channel/subchannel_index.h"
|
22
|
-
|
23
|
-
#include <stdbool.h>
|
24
|
-
#include <string.h>
|
25
|
-
|
26
|
-
#include <grpc/support/alloc.h>
|
27
|
-
#include <grpc/support/string_util.h>
|
28
|
-
|
29
|
-
#include "src/core/lib/avl/avl.h"
|
30
|
-
#include "src/core/lib/channel/channel_args.h"
|
31
|
-
#include "src/core/lib/gpr/tls.h"
|
32
|
-
|
33
|
-
// a map of subchannel_key --> subchannel, used for detecting connections
|
34
|
-
// to the same destination in order to share them
|
35
|
-
static grpc_avl g_subchannel_index;
|
36
|
-
|
37
|
-
static gpr_mu g_mu;
|
38
|
-
|
39
|
-
static gpr_refcount g_refcount;
|
40
|
-
|
41
|
-
struct grpc_subchannel_key {
|
42
|
-
grpc_subchannel_args args;
|
43
|
-
};
|
44
|
-
|
45
|
-
static bool g_force_creation = false;
|
46
|
-
|
47
|
-
static grpc_subchannel_key* create_key(
|
48
|
-
const grpc_subchannel_args* args,
|
49
|
-
grpc_channel_args* (*copy_channel_args)(const grpc_channel_args* args)) {
|
50
|
-
grpc_subchannel_key* k =
|
51
|
-
static_cast<grpc_subchannel_key*>(gpr_malloc(sizeof(*k)));
|
52
|
-
k->args.filter_count = args->filter_count;
|
53
|
-
if (k->args.filter_count > 0) {
|
54
|
-
k->args.filters = static_cast<const grpc_channel_filter**>(
|
55
|
-
gpr_malloc(sizeof(*k->args.filters) * k->args.filter_count));
|
56
|
-
memcpy(reinterpret_cast<grpc_channel_filter*>(k->args.filters),
|
57
|
-
args->filters, sizeof(*k->args.filters) * k->args.filter_count);
|
58
|
-
} else {
|
59
|
-
k->args.filters = nullptr;
|
60
|
-
}
|
61
|
-
k->args.args = copy_channel_args(args->args);
|
62
|
-
return k;
|
63
|
-
}
|
64
|
-
|
65
|
-
grpc_subchannel_key* grpc_subchannel_key_create(
|
66
|
-
const grpc_subchannel_args* args) {
|
67
|
-
return create_key(args, grpc_channel_args_normalize);
|
68
|
-
}
|
69
|
-
|
70
|
-
static grpc_subchannel_key* subchannel_key_copy(grpc_subchannel_key* k) {
|
71
|
-
return create_key(&k->args, grpc_channel_args_copy);
|
72
|
-
}
|
73
|
-
|
74
|
-
int grpc_subchannel_key_compare(const grpc_subchannel_key* a,
|
75
|
-
const grpc_subchannel_key* b) {
|
76
|
-
// To pretend the keys are different, return a non-zero value.
|
77
|
-
if (GPR_UNLIKELY(g_force_creation)) return 1;
|
78
|
-
int c = GPR_ICMP(a->args.filter_count, b->args.filter_count);
|
79
|
-
if (c != 0) return c;
|
80
|
-
if (a->args.filter_count > 0) {
|
81
|
-
c = memcmp(a->args.filters, b->args.filters,
|
82
|
-
a->args.filter_count * sizeof(*a->args.filters));
|
83
|
-
if (c != 0) return c;
|
84
|
-
}
|
85
|
-
return grpc_channel_args_compare(a->args.args, b->args.args);
|
86
|
-
}
|
87
|
-
|
88
|
-
void grpc_subchannel_key_destroy(grpc_subchannel_key* k) {
|
89
|
-
gpr_free(reinterpret_cast<grpc_channel_args*>(k->args.filters));
|
90
|
-
grpc_channel_args_destroy(const_cast<grpc_channel_args*>(k->args.args));
|
91
|
-
gpr_free(k);
|
92
|
-
}
|
93
|
-
|
94
|
-
static void sck_avl_destroy(void* p, void* unused) {
|
95
|
-
grpc_subchannel_key_destroy(static_cast<grpc_subchannel_key*>(p));
|
96
|
-
}
|
97
|
-
|
98
|
-
static void* sck_avl_copy(void* p, void* unused) {
|
99
|
-
return subchannel_key_copy(static_cast<grpc_subchannel_key*>(p));
|
100
|
-
}
|
101
|
-
|
102
|
-
static long sck_avl_compare(void* a, void* b, void* unused) {
|
103
|
-
return grpc_subchannel_key_compare(static_cast<grpc_subchannel_key*>(a),
|
104
|
-
static_cast<grpc_subchannel_key*>(b));
|
105
|
-
}
|
106
|
-
|
107
|
-
static void scv_avl_destroy(void* p, void* unused) {
|
108
|
-
GRPC_SUBCHANNEL_WEAK_UNREF((grpc_subchannel*)p, "subchannel_index");
|
109
|
-
}
|
110
|
-
|
111
|
-
static void* scv_avl_copy(void* p, void* unused) {
|
112
|
-
GRPC_SUBCHANNEL_WEAK_REF((grpc_subchannel*)p, "subchannel_index");
|
113
|
-
return p;
|
114
|
-
}
|
115
|
-
|
116
|
-
static const grpc_avl_vtable subchannel_avl_vtable = {
|
117
|
-
sck_avl_destroy, // destroy_key
|
118
|
-
sck_avl_copy, // copy_key
|
119
|
-
sck_avl_compare, // compare_keys
|
120
|
-
scv_avl_destroy, // destroy_value
|
121
|
-
scv_avl_copy // copy_value
|
122
|
-
};
|
123
|
-
|
124
|
-
void grpc_subchannel_index_init(void) {
|
125
|
-
g_subchannel_index = grpc_avl_create(&subchannel_avl_vtable);
|
126
|
-
gpr_mu_init(&g_mu);
|
127
|
-
gpr_ref_init(&g_refcount, 1);
|
128
|
-
}
|
129
|
-
|
130
|
-
void grpc_subchannel_index_shutdown(void) {
|
131
|
-
// TODO(juanlishen): This refcounting mechanism may lead to memory leackage.
|
132
|
-
// To solve that, we should force polling to flush any pending callbacks, then
|
133
|
-
// shutdown safely.
|
134
|
-
grpc_subchannel_index_unref();
|
135
|
-
}
|
136
|
-
|
137
|
-
void grpc_subchannel_index_unref(void) {
|
138
|
-
if (gpr_unref(&g_refcount)) {
|
139
|
-
gpr_mu_destroy(&g_mu);
|
140
|
-
grpc_avl_unref(g_subchannel_index, nullptr);
|
141
|
-
}
|
142
|
-
}
|
143
|
-
|
144
|
-
void grpc_subchannel_index_ref(void) { gpr_ref_non_zero(&g_refcount); }
|
145
|
-
|
146
|
-
grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key) {
|
147
|
-
// Lock, and take a reference to the subchannel index.
|
148
|
-
// We don't need to do the search under a lock as avl's are immutable.
|
149
|
-
gpr_mu_lock(&g_mu);
|
150
|
-
grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
|
151
|
-
gpr_mu_unlock(&g_mu);
|
152
|
-
|
153
|
-
grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(
|
154
|
-
(grpc_subchannel*)grpc_avl_get(index, key, nullptr), "index_find");
|
155
|
-
grpc_avl_unref(index, nullptr);
|
156
|
-
|
157
|
-
return c;
|
158
|
-
}
|
159
|
-
|
160
|
-
grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
|
161
|
-
grpc_subchannel* constructed) {
|
162
|
-
grpc_subchannel* c = nullptr;
|
163
|
-
bool need_to_unref_constructed = false;
|
164
|
-
|
165
|
-
while (c == nullptr) {
|
166
|
-
need_to_unref_constructed = false;
|
167
|
-
|
168
|
-
// Compare and swap loop:
|
169
|
-
// - take a reference to the current index
|
170
|
-
gpr_mu_lock(&g_mu);
|
171
|
-
grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
|
172
|
-
gpr_mu_unlock(&g_mu);
|
173
|
-
|
174
|
-
// - Check to see if a subchannel already exists
|
175
|
-
c = static_cast<grpc_subchannel*>(grpc_avl_get(index, key, nullptr));
|
176
|
-
if (c != nullptr) {
|
177
|
-
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
|
178
|
-
}
|
179
|
-
if (c != nullptr) {
|
180
|
-
// yes -> we're done
|
181
|
-
need_to_unref_constructed = true;
|
182
|
-
} else {
|
183
|
-
// no -> update the avl and compare/swap
|
184
|
-
grpc_avl updated = grpc_avl_add(
|
185
|
-
grpc_avl_ref(index, nullptr), subchannel_key_copy(key),
|
186
|
-
GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), nullptr);
|
187
|
-
|
188
|
-
// it may happen (but it's expected to be unlikely)
|
189
|
-
// that some other thread has changed the index:
|
190
|
-
// compare/swap here to check that, and retry as necessary
|
191
|
-
gpr_mu_lock(&g_mu);
|
192
|
-
if (index.root == g_subchannel_index.root) {
|
193
|
-
GPR_SWAP(grpc_avl, updated, g_subchannel_index);
|
194
|
-
c = constructed;
|
195
|
-
}
|
196
|
-
gpr_mu_unlock(&g_mu);
|
197
|
-
|
198
|
-
grpc_avl_unref(updated, nullptr);
|
199
|
-
}
|
200
|
-
grpc_avl_unref(index, nullptr);
|
201
|
-
}
|
202
|
-
|
203
|
-
if (need_to_unref_constructed) {
|
204
|
-
GRPC_SUBCHANNEL_UNREF(constructed, "index_register");
|
205
|
-
}
|
206
|
-
|
207
|
-
return c;
|
208
|
-
}
|
209
|
-
|
210
|
-
void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
|
211
|
-
grpc_subchannel* constructed) {
|
212
|
-
bool done = false;
|
213
|
-
while (!done) {
|
214
|
-
// Compare and swap loop:
|
215
|
-
// - take a reference to the current index
|
216
|
-
gpr_mu_lock(&g_mu);
|
217
|
-
grpc_avl index = grpc_avl_ref(g_subchannel_index, nullptr);
|
218
|
-
gpr_mu_unlock(&g_mu);
|
219
|
-
|
220
|
-
// Check to see if this key still refers to the previously
|
221
|
-
// registered subchannel
|
222
|
-
grpc_subchannel* c =
|
223
|
-
static_cast<grpc_subchannel*>(grpc_avl_get(index, key, nullptr));
|
224
|
-
if (c != constructed) {
|
225
|
-
grpc_avl_unref(index, nullptr);
|
226
|
-
break;
|
227
|
-
}
|
228
|
-
|
229
|
-
// compare and swap the update (some other thread may have
|
230
|
-
// mutated the index behind us)
|
231
|
-
grpc_avl updated =
|
232
|
-
grpc_avl_remove(grpc_avl_ref(index, nullptr), key, nullptr);
|
233
|
-
|
234
|
-
gpr_mu_lock(&g_mu);
|
235
|
-
if (index.root == g_subchannel_index.root) {
|
236
|
-
GPR_SWAP(grpc_avl, updated, g_subchannel_index);
|
237
|
-
done = true;
|
238
|
-
}
|
239
|
-
gpr_mu_unlock(&g_mu);
|
240
|
-
|
241
|
-
grpc_avl_unref(updated, nullptr);
|
242
|
-
grpc_avl_unref(index, nullptr);
|
243
|
-
}
|
244
|
-
}
|
245
|
-
|
246
|
-
void grpc_subchannel_index_test_only_set_force_creation(bool force_creation) {
|
247
|
-
g_force_creation = force_creation;
|
248
|
-
}
|