grpc 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +225 -87
  3. data/etc/roots.pem +0 -33
  4. data/include/grpc/grpc_security.h +70 -0
  5. data/include/grpc/impl/codegen/port_platform.h +11 -0
  6. data/include/grpc/support/log.h +9 -1
  7. data/src/core/ext/filters/client_channel/client_channel.cc +305 -210
  8. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
  9. data/src/core/ext/filters/client_channel/lb_policy.cc +2 -2
  10. data/src/core/ext/filters/client_channel/lb_policy.h +4 -0
  11. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +12 -9
  12. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +168 -197
  13. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +368 -373
  14. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +498 -98
  15. data/src/core/ext/filters/client_channel/method_params.h +4 -0
  16. data/src/core/ext/filters/client_channel/resolver.h +4 -0
  17. data/src/core/ext/filters/client_channel/retry_throttle.h +4 -0
  18. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -2
  19. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +40 -15
  20. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +3 -3
  21. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -2
  22. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +1 -1
  23. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
  24. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
  25. data/src/core/ext/transport/chttp2/transport/writing.cc +5 -5
  26. data/src/core/ext/transport/inproc/inproc_transport.cc +41 -43
  27. data/src/core/lib/channel/channel_args.cc +28 -0
  28. data/src/core/lib/channel/channel_args.h +4 -0
  29. data/src/core/lib/channel/handshaker.cc +47 -0
  30. data/src/core/lib/channel/handshaker.h +4 -0
  31. data/src/core/lib/debug/trace.cc +2 -1
  32. data/src/core/lib/debug/trace.h +10 -1
  33. data/src/core/lib/gpr/log.cc +8 -2
  34. data/src/core/lib/gpr/log_android.cc +4 -0
  35. data/src/core/lib/gpr/log_linux.cc +4 -0
  36. data/src/core/lib/gpr/log_posix.cc +4 -0
  37. data/src/core/lib/gpr/log_windows.cc +5 -0
  38. data/src/core/lib/gprpp/inlined_vector.h +30 -34
  39. data/src/core/lib/gprpp/orphanable.h +4 -4
  40. data/src/core/lib/gprpp/ref_counted.h +4 -4
  41. data/src/core/lib/iomgr/call_combiner.cc +13 -13
  42. data/src/core/lib/iomgr/closure.h +3 -3
  43. data/src/core/lib/iomgr/combiner.cc +11 -11
  44. data/src/core/lib/iomgr/ev_epoll1_linux.cc +24 -24
  45. data/src/core/lib/iomgr/ev_epollex_linux.cc +48 -29
  46. data/src/core/lib/iomgr/ev_epollsig_linux.cc +2 -2
  47. data/src/core/lib/iomgr/ev_poll_posix.cc +9 -3
  48. data/src/core/lib/iomgr/ev_posix.cc +3 -3
  49. data/src/core/lib/iomgr/executor.cc +6 -6
  50. data/src/core/lib/iomgr/resource_quota.cc +10 -11
  51. data/src/core/lib/iomgr/socket_utils_common_posix.cc +24 -0
  52. data/src/core/lib/iomgr/socket_utils_linux.cc +0 -1
  53. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -3
  54. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  55. data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
  56. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -4
  57. data/src/core/lib/iomgr/tcp_custom.cc +10 -10
  58. data/src/core/lib/iomgr/tcp_posix.cc +25 -25
  59. data/src/core/lib/iomgr/tcp_server_custom.cc +5 -5
  60. data/src/core/lib/iomgr/tcp_server_posix.cc +4 -25
  61. data/src/core/lib/iomgr/tcp_server_windows.cc +1 -0
  62. data/src/core/lib/iomgr/tcp_uv.cc +3 -0
  63. data/src/core/lib/iomgr/tcp_windows.cc +16 -0
  64. data/src/core/lib/iomgr/timer_generic.cc +27 -17
  65. data/src/core/lib/iomgr/timer_manager.cc +11 -12
  66. data/src/core/lib/iomgr/timer_uv.cc +3 -0
  67. data/src/core/lib/iomgr/udp_server.cc +104 -49
  68. data/src/core/lib/iomgr/udp_server.h +8 -4
  69. data/src/core/lib/profiling/basic_timers.cc +1 -0
  70. data/src/core/lib/security/credentials/alts/alts_credentials.h +0 -20
  71. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_client_options.cc +7 -7
  72. data/src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h +1 -38
  73. data/src/core/lib/security/security_connector/security_connector.cc +19 -16
  74. data/src/core/lib/security/security_connector/security_connector.h +4 -3
  75. data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
  76. data/src/core/lib/security/transport/security_handshaker.cc +6 -2
  77. data/src/core/lib/slice/slice.cc +6 -2
  78. data/src/core/lib/slice/slice_buffer.cc +12 -4
  79. data/src/core/lib/slice/slice_hash_table.h +4 -0
  80. data/src/core/lib/slice/slice_weak_hash_table.h +4 -0
  81. data/src/core/lib/surface/call.cc +6 -6
  82. data/src/core/lib/surface/server.cc +16 -0
  83. data/src/core/lib/surface/version.cc +1 -1
  84. data/src/core/lib/transport/bdp_estimator.cc +3 -3
  85. data/src/core/lib/transport/bdp_estimator.h +2 -2
  86. data/src/core/lib/transport/connectivity_state.cc +6 -7
  87. data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +4 -0
  88. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +14 -0
  89. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +21 -0
  90. data/src/ruby/lib/grpc/version.rb +1 -1
  91. data/src/ruby/pb/generate_proto_ruby.sh +7 -1
  92. data/src/ruby/spec/pb/package_with_underscore/checker_spec.rb +2 -5
  93. data/third_party/address_sorting/address_sorting.c +10 -9
  94. metadata +27 -28
  95. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +0 -253
@@ -50,7 +50,7 @@ class BdpEstimator {
50
50
  // transport (but not necessarily started)
51
51
  void SchedulePing() {
52
52
  if (grpc_bdp_estimator_trace.enabled()) {
53
- gpr_log(GPR_DEBUG, "bdp[%s]:sched acc=%" PRId64 " est=%" PRId64, name_,
53
+ gpr_log(GPR_INFO, "bdp[%s]:sched acc=%" PRId64 " est=%" PRId64, name_,
54
54
  accumulator_, estimate_);
55
55
  }
56
56
  GPR_ASSERT(ping_state_ == PingState::UNSCHEDULED);
@@ -63,7 +63,7 @@ class BdpEstimator {
63
63
  // the ping is on the wire
64
64
  void StartPing() {
65
65
  if (grpc_bdp_estimator_trace.enabled()) {
66
- gpr_log(GPR_DEBUG, "bdp[%s]:start acc=%" PRId64 " est=%" PRId64, name_,
66
+ gpr_log(GPR_INFO, "bdp[%s]:start acc=%" PRId64 " est=%" PRId64, name_,
67
67
  accumulator_, estimate_);
68
68
  }
69
69
  GPR_ASSERT(ping_state_ == PingState::SCHEDULED);
@@ -78,7 +78,7 @@ grpc_connectivity_state grpc_connectivity_state_check(
78
78
  grpc_connectivity_state cur = static_cast<grpc_connectivity_state>(
79
79
  gpr_atm_no_barrier_load(&tracker->current_state_atm));
80
80
  if (grpc_connectivity_state_trace.enabled()) {
81
- gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name,
81
+ gpr_log(GPR_INFO, "CONWATCH: %p %s: get %s", tracker, tracker->name,
82
82
  grpc_connectivity_state_name(cur));
83
83
  }
84
84
  return cur;
@@ -89,7 +89,7 @@ grpc_connectivity_state grpc_connectivity_state_get(
89
89
  grpc_connectivity_state cur = static_cast<grpc_connectivity_state>(
90
90
  gpr_atm_no_barrier_load(&tracker->current_state_atm));
91
91
  if (grpc_connectivity_state_trace.enabled()) {
92
- gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name,
92
+ gpr_log(GPR_INFO, "CONWATCH: %p %s: get %s", tracker, tracker->name,
93
93
  grpc_connectivity_state_name(cur));
94
94
  }
95
95
  if (error != nullptr) {
@@ -110,10 +110,10 @@ bool grpc_connectivity_state_notify_on_state_change(
110
110
  gpr_atm_no_barrier_load(&tracker->current_state_atm));
111
111
  if (grpc_connectivity_state_trace.enabled()) {
112
112
  if (current == nullptr) {
113
- gpr_log(GPR_DEBUG, "CONWATCH: %p %s: unsubscribe notify=%p", tracker,
113
+ gpr_log(GPR_INFO, "CONWATCH: %p %s: unsubscribe notify=%p", tracker,
114
114
  tracker->name, notify);
115
115
  } else {
116
- gpr_log(GPR_DEBUG, "CONWATCH: %p %s: from %s [cur=%s] notify=%p", tracker,
116
+ gpr_log(GPR_INFO, "CONWATCH: %p %s: from %s [cur=%s] notify=%p", tracker,
117
117
  tracker->name, grpc_connectivity_state_name(*current),
118
118
  grpc_connectivity_state_name(cur), notify);
119
119
  }
@@ -161,7 +161,7 @@ void grpc_connectivity_state_set(grpc_connectivity_state_tracker* tracker,
161
161
  grpc_connectivity_state_watcher* w;
162
162
  if (grpc_connectivity_state_trace.enabled()) {
163
163
  const char* error_string = grpc_error_string(error);
164
- gpr_log(GPR_DEBUG, "SET: %p %s: %s --> %s [%s] error=%p %s", tracker,
164
+ gpr_log(GPR_INFO, "SET: %p %s: %s --> %s [%s] error=%p %s", tracker,
165
165
  tracker->name, grpc_connectivity_state_name(cur),
166
166
  grpc_connectivity_state_name(state), reason, error, error_string);
167
167
  }
@@ -187,8 +187,7 @@ void grpc_connectivity_state_set(grpc_connectivity_state_tracker* tracker,
187
187
  *w->current = state;
188
188
  tracker->watchers = w->next;
189
189
  if (grpc_connectivity_state_trace.enabled()) {
190
- gpr_log(GPR_DEBUG, "NOTIFY: %p %s: %p", tracker, tracker->name,
191
- w->notify);
190
+ gpr_log(GPR_INFO, "NOTIFY: %p %s: %p", tracker, tracker->name, w->notify);
192
191
  }
193
192
  GRPC_CLOSURE_SCHED(w->notify, GRPC_ERROR_REF(tracker->current_error));
194
193
  gpr_free(w);
@@ -69,6 +69,10 @@ class SslSessionLRUCache : public grpc_core::RefCounted<SslSessionLRUCache> {
69
69
  template <typename T, typename... Args>
70
70
  friend T* grpc_core::New(Args&&... args);
71
71
 
72
+ // So Delete() can call our private dtor.
73
+ template <typename T>
74
+ friend void grpc_core::Delete(T*);
75
+
72
76
  class Node;
73
77
 
74
78
  explicit SslSessionLRUCache(size_t capacity);
@@ -138,6 +138,12 @@ grpc_ssl_server_credentials_create_with_options_type grpc_ssl_server_credentials
138
138
  grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
139
139
  grpc_call_set_credentials_type grpc_call_set_credentials_import;
140
140
  grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
141
+ grpc_alts_credentials_client_options_create_type grpc_alts_credentials_client_options_create_import;
142
+ grpc_alts_credentials_server_options_create_type grpc_alts_credentials_server_options_create_import;
143
+ grpc_alts_credentials_client_options_add_target_service_account_type grpc_alts_credentials_client_options_add_target_service_account_import;
144
+ grpc_alts_credentials_options_destroy_type grpc_alts_credentials_options_destroy_import;
145
+ grpc_alts_credentials_create_type grpc_alts_credentials_create_import;
146
+ grpc_alts_server_credentials_create_type grpc_alts_server_credentials_create_import;
141
147
  grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
142
148
  grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
143
149
  grpc_byte_buffer_copy_type grpc_byte_buffer_copy_import;
@@ -208,6 +214,7 @@ gpr_cpu_num_cores_type gpr_cpu_num_cores_import;
208
214
  gpr_cpu_current_cpu_type gpr_cpu_current_cpu_import;
209
215
  gpr_log_severity_string_type gpr_log_severity_string_import;
210
216
  gpr_log_type gpr_log_import;
217
+ gpr_should_log_type gpr_should_log_import;
211
218
  gpr_log_message_type gpr_log_message_import;
212
219
  gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
213
220
  gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
@@ -379,6 +386,12 @@ void grpc_rb_load_imports(HMODULE library) {
379
386
  grpc_server_add_secure_http2_port_import = (grpc_server_add_secure_http2_port_type) GetProcAddress(library, "grpc_server_add_secure_http2_port");
380
387
  grpc_call_set_credentials_import = (grpc_call_set_credentials_type) GetProcAddress(library, "grpc_call_set_credentials");
381
388
  grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor");
389
+ grpc_alts_credentials_client_options_create_import = (grpc_alts_credentials_client_options_create_type) GetProcAddress(library, "grpc_alts_credentials_client_options_create");
390
+ grpc_alts_credentials_server_options_create_import = (grpc_alts_credentials_server_options_create_type) GetProcAddress(library, "grpc_alts_credentials_server_options_create");
391
+ grpc_alts_credentials_client_options_add_target_service_account_import = (grpc_alts_credentials_client_options_add_target_service_account_type) GetProcAddress(library, "grpc_alts_credentials_client_options_add_target_service_account");
392
+ grpc_alts_credentials_options_destroy_import = (grpc_alts_credentials_options_destroy_type) GetProcAddress(library, "grpc_alts_credentials_options_destroy");
393
+ grpc_alts_credentials_create_import = (grpc_alts_credentials_create_type) GetProcAddress(library, "grpc_alts_credentials_create");
394
+ grpc_alts_server_credentials_create_import = (grpc_alts_server_credentials_create_type) GetProcAddress(library, "grpc_alts_server_credentials_create");
382
395
  grpc_raw_byte_buffer_create_import = (grpc_raw_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_byte_buffer_create");
383
396
  grpc_raw_compressed_byte_buffer_create_import = (grpc_raw_compressed_byte_buffer_create_type) GetProcAddress(library, "grpc_raw_compressed_byte_buffer_create");
384
397
  grpc_byte_buffer_copy_import = (grpc_byte_buffer_copy_type) GetProcAddress(library, "grpc_byte_buffer_copy");
@@ -449,6 +462,7 @@ void grpc_rb_load_imports(HMODULE library) {
449
462
  gpr_cpu_current_cpu_import = (gpr_cpu_current_cpu_type) GetProcAddress(library, "gpr_cpu_current_cpu");
450
463
  gpr_log_severity_string_import = (gpr_log_severity_string_type) GetProcAddress(library, "gpr_log_severity_string");
451
464
  gpr_log_import = (gpr_log_type) GetProcAddress(library, "gpr_log");
465
+ gpr_should_log_import = (gpr_should_log_type) GetProcAddress(library, "gpr_should_log");
452
466
  gpr_log_message_import = (gpr_log_message_type) GetProcAddress(library, "gpr_log_message");
453
467
  gpr_set_log_verbosity_import = (gpr_set_log_verbosity_type) GetProcAddress(library, "gpr_set_log_verbosity");
454
468
  gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init");
@@ -389,6 +389,24 @@ extern grpc_call_set_credentials_type grpc_call_set_credentials_import;
389
389
  typedef void(*grpc_server_credentials_set_auth_metadata_processor_type)(grpc_server_credentials* creds, grpc_auth_metadata_processor processor);
390
390
  extern grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
391
391
  #define grpc_server_credentials_set_auth_metadata_processor grpc_server_credentials_set_auth_metadata_processor_import
392
+ typedef grpc_alts_credentials_options*(*grpc_alts_credentials_client_options_create_type)();
393
+ extern grpc_alts_credentials_client_options_create_type grpc_alts_credentials_client_options_create_import;
394
+ #define grpc_alts_credentials_client_options_create grpc_alts_credentials_client_options_create_import
395
+ typedef grpc_alts_credentials_options*(*grpc_alts_credentials_server_options_create_type)();
396
+ extern grpc_alts_credentials_server_options_create_type grpc_alts_credentials_server_options_create_import;
397
+ #define grpc_alts_credentials_server_options_create grpc_alts_credentials_server_options_create_import
398
+ typedef void(*grpc_alts_credentials_client_options_add_target_service_account_type)(grpc_alts_credentials_options* options, const char* service_account);
399
+ extern grpc_alts_credentials_client_options_add_target_service_account_type grpc_alts_credentials_client_options_add_target_service_account_import;
400
+ #define grpc_alts_credentials_client_options_add_target_service_account grpc_alts_credentials_client_options_add_target_service_account_import
401
+ typedef void(*grpc_alts_credentials_options_destroy_type)(grpc_alts_credentials_options* options);
402
+ extern grpc_alts_credentials_options_destroy_type grpc_alts_credentials_options_destroy_import;
403
+ #define grpc_alts_credentials_options_destroy grpc_alts_credentials_options_destroy_import
404
+ typedef grpc_channel_credentials*(*grpc_alts_credentials_create_type)(const grpc_alts_credentials_options* options);
405
+ extern grpc_alts_credentials_create_type grpc_alts_credentials_create_import;
406
+ #define grpc_alts_credentials_create grpc_alts_credentials_create_import
407
+ typedef grpc_server_credentials*(*grpc_alts_server_credentials_create_type)(const grpc_alts_credentials_options* options);
408
+ extern grpc_alts_server_credentials_create_type grpc_alts_server_credentials_create_import;
409
+ #define grpc_alts_server_credentials_create grpc_alts_server_credentials_create_import
392
410
  typedef grpc_byte_buffer*(*grpc_raw_byte_buffer_create_type)(grpc_slice* slices, size_t nslices);
393
411
  extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
394
412
  #define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
@@ -599,6 +617,9 @@ extern gpr_log_severity_string_type gpr_log_severity_string_import;
599
617
  typedef void(*gpr_log_type)(const char* file, int line, gpr_log_severity severity, const char* format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
600
618
  extern gpr_log_type gpr_log_import;
601
619
  #define gpr_log gpr_log_import
620
+ typedef int(*gpr_should_log_type)(gpr_log_severity severity);
621
+ extern gpr_should_log_type gpr_should_log_import;
622
+ #define gpr_should_log gpr_should_log_import
602
623
  typedef void(*gpr_log_message_type)(const char* file, int line, gpr_log_severity severity, const char* message);
603
624
  extern gpr_log_message_type gpr_log_message_import;
604
625
  #define gpr_log_message gpr_log_message_import
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.11.1'
17
+ VERSION = '1.12.0'
18
18
  end
@@ -32,7 +32,13 @@ $PROTOC -I . \
32
32
  --plugin=$PLUGIN
33
33
 
34
34
  $PROTOC -I . \
35
- src/proto/grpc/testing/{messages,payloads,stats,services,control}.proto \
35
+ src/proto/grpc/core/stats.proto \
36
+ --grpc_out=src/ruby/qps \
37
+ --ruby_out=src/ruby/qps \
38
+ --plugin=$PLUGIN
39
+
40
+ $PROTOC -I . \
41
+ src/proto/grpc/testing/{messages,payloads,stats,benchmark_service,report_qps_scenario_service,worker_service,control}.proto \
36
42
  --grpc_out=src/ruby/qps \
37
43
  --ruby_out=src/ruby/qps \
38
44
  --plugin=$PLUGIN
@@ -15,16 +15,13 @@
15
15
  require 'open3'
16
16
  require 'tmpdir'
17
17
 
18
- def debug_mode?
19
- !ENV['CONFIG'].nil? && ENV['CONFIG'] == 'dbg'
20
- end
21
-
22
18
  describe 'Package with underscore protobuf code generation' do
23
19
  it 'should have the same content as created by code generation' do
24
20
  root_dir = File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..')
25
21
  pb_dir = File.join(root_dir, 'src', 'ruby', 'spec', 'pb')
26
22
 
27
- bins_sub_dir = debug_mode? ? 'dbg' : 'opt'
23
+ fail 'CONFIG env variable unexpectedly unset' unless ENV['CONFIG']
24
+ bins_sub_dir = ENV['CONFIG']
28
25
  bins_dir = File.join(root_dir, 'bins', bins_sub_dir)
29
26
 
30
27
  plugin = File.join(bins_dir, 'grpc_ruby_plugin')
@@ -225,15 +225,15 @@ static int compare_source_addr_exists(const address_sorting_sortable* first,
225
225
  static int compare_source_dest_scope_matches(
226
226
  const address_sorting_sortable* first,
227
227
  const address_sorting_sortable* second) {
228
- int first_src_dst_scope_matches = 0;
228
+ bool first_src_dst_scope_matches = false;
229
229
  if (sockaddr_get_scope(&first->dest_addr) ==
230
230
  sockaddr_get_scope(&first->source_addr)) {
231
- first_src_dst_scope_matches = 1;
231
+ first_src_dst_scope_matches = true;
232
232
  }
233
- int second_src_dst_scope_matches = 0;
233
+ bool second_src_dst_scope_matches = false;
234
234
  if (sockaddr_get_scope(&second->dest_addr) ==
235
235
  sockaddr_get_scope(&second->source_addr)) {
236
- second_src_dst_scope_matches = 1;
236
+ second_src_dst_scope_matches = true;
237
237
  }
238
238
  if (first_src_dst_scope_matches != second_src_dst_scope_matches) {
239
239
  return first_src_dst_scope_matches ? -1 : 1;
@@ -244,18 +244,18 @@ static int compare_source_dest_scope_matches(
244
244
  static int compare_source_dest_labels_match(
245
245
  const address_sorting_sortable* first,
246
246
  const address_sorting_sortable* second) {
247
- int first_label_matches = 0;
247
+ bool first_label_matches = false;
248
248
  if (get_label_value(&first->dest_addr) ==
249
249
  get_label_value(&first->source_addr)) {
250
- first_label_matches = 1;
250
+ first_label_matches = true;
251
251
  }
252
- int second_label_matches = 0;
252
+ bool second_label_matches = false;
253
253
  if (get_label_value(&second->dest_addr) ==
254
254
  get_label_value(&second->source_addr)) {
255
- second_label_matches = 1;
255
+ second_label_matches = true;
256
256
  }
257
257
  if (first_label_matches != second_label_matches) {
258
- return first_label_matches ? 1 : 1;
258
+ return first_label_matches ? -1 : 1;
259
259
  }
260
260
  return 0;
261
261
  }
@@ -366,4 +366,5 @@ void address_sorting_shutdown() {
366
366
  abort();
367
367
  }
368
368
  g_current_source_addr_factory->vtable->destroy(g_current_source_addr_factory);
369
+ g_current_source_addr_factory = NULL;
369
370
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - gRPC Authors
@@ -293,7 +293,6 @@ files:
293
293
  - src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
294
294
  - src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
295
295
  - src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
296
- - src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
297
296
  - src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
298
297
  - src/core/ext/filters/client_channel/lb_policy_factory.cc
299
298
  - src/core/ext/filters/client_channel/lb_policy_factory.h
@@ -1548,39 +1547,39 @@ signing_key:
1548
1547
  specification_version: 4
1549
1548
  summary: GRPC system in Ruby
1550
1549
  test_files:
1551
- - src/ruby/spec/time_consts_spec.rb
1552
- - src/ruby/spec/client_auth_spec.rb
1553
- - src/ruby/spec/generic/interceptor_registry_spec.rb
1550
+ - src/ruby/spec/spec_helper.rb
1551
+ - src/ruby/spec/channel_connection_spec.rb
1552
+ - src/ruby/spec/server_spec.rb
1553
+ - src/ruby/spec/support/services.rb
1554
+ - src/ruby/spec/support/helpers.rb
1555
+ - src/ruby/spec/channel_spec.rb
1556
+ - src/ruby/spec/server_credentials_spec.rb
1557
+ - src/ruby/spec/generic/rpc_server_pool_spec.rb
1554
1558
  - src/ruby/spec/generic/rpc_desc_spec.rb
1555
- - src/ruby/spec/generic/rpc_server_spec.rb
1559
+ - src/ruby/spec/generic/active_call_spec.rb
1560
+ - src/ruby/spec/generic/server_interceptors_spec.rb
1556
1561
  - src/ruby/spec/generic/service_spec.rb
1562
+ - src/ruby/spec/generic/rpc_server_spec.rb
1557
1563
  - src/ruby/spec/generic/client_stub_spec.rb
1558
- - src/ruby/spec/generic/server_interceptors_spec.rb
1559
1564
  - src/ruby/spec/generic/client_interceptors_spec.rb
1560
- - src/ruby/spec/generic/active_call_spec.rb
1561
- - src/ruby/spec/generic/rpc_server_pool_spec.rb
1562
- - src/ruby/spec/server_spec.rb
1565
+ - src/ruby/spec/generic/interceptor_registry_spec.rb
1563
1566
  - src/ruby/spec/client_server_spec.rb
1564
- - src/ruby/spec/pb/package_with_underscore/checker_spec.rb
1565
- - src/ruby/spec/pb/package_with_underscore/data.proto
1567
+ - src/ruby/spec/time_consts_spec.rb
1568
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
1569
+ - src/ruby/spec/compression_options_spec.rb
1570
+ - src/ruby/spec/error_sanity_spec.rb
1571
+ - src/ruby/spec/call_credentials_spec.rb
1572
+ - src/ruby/spec/channel_credentials_spec.rb
1573
+ - src/ruby/spec/pb/health/checker_spec.rb
1566
1574
  - src/ruby/spec/pb/package_with_underscore/service.proto
1575
+ - src/ruby/spec/pb/package_with_underscore/data.proto
1576
+ - src/ruby/spec/pb/package_with_underscore/checker_spec.rb
1567
1577
  - src/ruby/spec/pb/duplicate/codegen_spec.rb
1568
- - src/ruby/spec/pb/health/checker_spec.rb
1569
- - src/ruby/spec/server_credentials_spec.rb
1570
- - src/ruby/spec/channel_spec.rb
1571
- - src/ruby/spec/support/helpers.rb
1572
- - src/ruby/spec/support/services.rb
1573
- - src/ruby/spec/call_spec.rb
1574
- - src/ruby/spec/error_sanity_spec.rb
1575
- - src/ruby/spec/spec_helper.rb
1576
- - src/ruby/spec/testdata/server1.pem
1577
1578
  - src/ruby/spec/testdata/client.pem
1579
+ - src/ruby/spec/testdata/ca.pem
1578
1580
  - src/ruby/spec/testdata/server1.key
1579
- - src/ruby/spec/testdata/README
1580
1581
  - src/ruby/spec/testdata/client.key
1581
- - src/ruby/spec/testdata/ca.pem
1582
- - src/ruby/spec/call_credentials_spec.rb
1583
- - src/ruby/spec/channel_credentials_spec.rb
1584
- - src/ruby/spec/channel_connection_spec.rb
1585
- - src/ruby/spec/google_rpc_status_utils_spec.rb
1586
- - src/ruby/spec/compression_options_spec.rb
1582
+ - src/ruby/spec/testdata/server1.pem
1583
+ - src/ruby/spec/testdata/README
1584
+ - src/ruby/spec/call_spec.rb
1585
+ - src/ruby/spec/client_auth_spec.rb
@@ -1,253 +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
-
25
- #include "src/core/ext/filters/client_channel/lb_policy/subchannel_list.h"
26
- #include "src/core/lib/channel/channel_args.h"
27
- #include "src/core/lib/debug/trace.h"
28
- #include "src/core/lib/iomgr/closure.h"
29
- #include "src/core/lib/iomgr/combiner.h"
30
- #include "src/core/lib/iomgr/sockaddr_utils.h"
31
- #include "src/core/lib/transport/connectivity_state.h"
32
-
33
- void grpc_lb_subchannel_data_unref_subchannel(grpc_lb_subchannel_data* sd,
34
- const char* reason) {
35
- if (sd->subchannel != nullptr) {
36
- if (sd->subchannel_list->tracer->enabled()) {
37
- gpr_log(GPR_DEBUG,
38
- "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
39
- " (subchannel %p): unreffing subchannel",
40
- sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
41
- sd->subchannel_list,
42
- static_cast<size_t>(sd - sd->subchannel_list->subchannels),
43
- sd->subchannel_list->num_subchannels, sd->subchannel);
44
- }
45
- GRPC_SUBCHANNEL_UNREF(sd->subchannel, reason);
46
- sd->subchannel = nullptr;
47
- sd->connected_subchannel.reset();
48
- if (sd->user_data != nullptr) {
49
- GPR_ASSERT(sd->user_data_vtable != nullptr);
50
- sd->user_data_vtable->destroy(sd->user_data);
51
- sd->user_data = nullptr;
52
- }
53
- }
54
- }
55
-
56
- void grpc_lb_subchannel_data_start_connectivity_watch(
57
- grpc_lb_subchannel_data* sd) {
58
- if (sd->subchannel_list->tracer->enabled()) {
59
- gpr_log(
60
- GPR_DEBUG,
61
- "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
62
- " (subchannel %p): requesting connectivity change "
63
- "notification (from %s)",
64
- sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
65
- sd->subchannel_list,
66
- static_cast<size_t>(sd - sd->subchannel_list->subchannels),
67
- sd->subchannel_list->num_subchannels, sd->subchannel,
68
- grpc_connectivity_state_name(sd->pending_connectivity_state_unsafe));
69
- }
70
- sd->connectivity_notification_pending = true;
71
- grpc_subchannel_notify_on_state_change(
72
- sd->subchannel, sd->subchannel_list->policy->interested_parties(),
73
- &sd->pending_connectivity_state_unsafe,
74
- &sd->connectivity_changed_closure);
75
- }
76
-
77
- void grpc_lb_subchannel_data_stop_connectivity_watch(
78
- grpc_lb_subchannel_data* sd) {
79
- if (sd->subchannel_list->tracer->enabled()) {
80
- gpr_log(GPR_DEBUG,
81
- "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
82
- " (subchannel %p): stopping connectivity watch",
83
- sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
84
- sd->subchannel_list,
85
- static_cast<size_t>(sd - sd->subchannel_list->subchannels),
86
- sd->subchannel_list->num_subchannels, sd->subchannel);
87
- }
88
- GPR_ASSERT(sd->connectivity_notification_pending);
89
- sd->connectivity_notification_pending = false;
90
- }
91
-
92
- grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
93
- grpc_core::LoadBalancingPolicy* p, grpc_core::TraceFlag* tracer,
94
- const grpc_lb_addresses* addresses, grpc_combiner* combiner,
95
- grpc_client_channel_factory* client_channel_factory,
96
- const grpc_channel_args& args, grpc_iomgr_cb_func connectivity_changed_cb) {
97
- grpc_lb_subchannel_list* subchannel_list =
98
- static_cast<grpc_lb_subchannel_list*>(
99
- gpr_zalloc(sizeof(*subchannel_list)));
100
- if (tracer->enabled()) {
101
- gpr_log(GPR_DEBUG,
102
- "[%s %p] Creating subchannel list %p for %" PRIuPTR " subchannels",
103
- tracer->name(), p, subchannel_list, addresses->num_addresses);
104
- }
105
- subchannel_list->policy = p;
106
- subchannel_list->tracer = tracer;
107
- gpr_ref_init(&subchannel_list->refcount, 1);
108
- subchannel_list->subchannels = static_cast<grpc_lb_subchannel_data*>(
109
- gpr_zalloc(sizeof(grpc_lb_subchannel_data) * addresses->num_addresses));
110
- // We need to remove the LB addresses in order to be able to compare the
111
- // subchannel keys of subchannels from a different batch of addresses.
112
- static const char* keys_to_remove[] = {GRPC_ARG_SUBCHANNEL_ADDRESS,
113
- GRPC_ARG_LB_ADDRESSES};
114
- // Create a subchannel for each address.
115
- grpc_subchannel_args sc_args;
116
- size_t subchannel_index = 0;
117
- for (size_t i = 0; i < addresses->num_addresses; i++) {
118
- // If there were any balancer, we would have chosen grpclb policy instead.
119
- GPR_ASSERT(!addresses->addresses[i].is_balancer);
120
- memset(&sc_args, 0, sizeof(grpc_subchannel_args));
121
- grpc_arg addr_arg =
122
- grpc_create_subchannel_address_arg(&addresses->addresses[i].address);
123
- grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
124
- &args, keys_to_remove, GPR_ARRAY_SIZE(keys_to_remove), &addr_arg, 1);
125
- gpr_free(addr_arg.value.string);
126
- sc_args.args = new_args;
127
- grpc_subchannel* subchannel = grpc_client_channel_factory_create_subchannel(
128
- client_channel_factory, &sc_args);
129
- grpc_channel_args_destroy(new_args);
130
- if (subchannel == nullptr) {
131
- // Subchannel could not be created.
132
- if (tracer->enabled()) {
133
- char* address_uri =
134
- grpc_sockaddr_to_uri(&addresses->addresses[i].address);
135
- gpr_log(GPR_DEBUG,
136
- "[%s %p] could not create subchannel for address uri %s, "
137
- "ignoring",
138
- tracer->name(), subchannel_list->policy, address_uri);
139
- gpr_free(address_uri);
140
- }
141
- continue;
142
- }
143
- if (tracer->enabled()) {
144
- char* address_uri =
145
- grpc_sockaddr_to_uri(&addresses->addresses[i].address);
146
- gpr_log(GPR_DEBUG,
147
- "[%s %p] subchannel list %p index %" PRIuPTR
148
- ": Created subchannel %p for address uri %s",
149
- tracer->name(), p, subchannel_list, subchannel_index, subchannel,
150
- address_uri);
151
- gpr_free(address_uri);
152
- }
153
- grpc_lb_subchannel_data* sd =
154
- &subchannel_list->subchannels[subchannel_index++];
155
- sd->subchannel_list = subchannel_list;
156
- sd->subchannel = subchannel;
157
- GRPC_CLOSURE_INIT(&sd->connectivity_changed_closure,
158
- connectivity_changed_cb, sd,
159
- grpc_combiner_scheduler(combiner));
160
- // We assume that the current state is IDLE. If not, we'll get a
161
- // callback telling us that.
162
- sd->prev_connectivity_state = GRPC_CHANNEL_IDLE;
163
- sd->curr_connectivity_state = GRPC_CHANNEL_IDLE;
164
- sd->pending_connectivity_state_unsafe = GRPC_CHANNEL_IDLE;
165
- sd->user_data_vtable = addresses->user_data_vtable;
166
- if (sd->user_data_vtable != nullptr) {
167
- sd->user_data =
168
- sd->user_data_vtable->copy(addresses->addresses[i].user_data);
169
- }
170
- }
171
- subchannel_list->num_subchannels = subchannel_index;
172
- subchannel_list->num_idle = subchannel_index;
173
- return subchannel_list;
174
- }
175
-
176
- static void subchannel_list_destroy(grpc_lb_subchannel_list* subchannel_list) {
177
- if (subchannel_list->tracer->enabled()) {
178
- gpr_log(GPR_DEBUG, "[%s %p] Destroying subchannel_list %p",
179
- subchannel_list->tracer->name(), subchannel_list->policy,
180
- subchannel_list);
181
- }
182
- for (size_t i = 0; i < subchannel_list->num_subchannels; i++) {
183
- grpc_lb_subchannel_data* sd = &subchannel_list->subchannels[i];
184
- grpc_lb_subchannel_data_unref_subchannel(sd, "subchannel_list_destroy");
185
- }
186
- gpr_free(subchannel_list->subchannels);
187
- gpr_free(subchannel_list);
188
- }
189
-
190
- void grpc_lb_subchannel_list_ref(grpc_lb_subchannel_list* subchannel_list,
191
- const char* reason) {
192
- gpr_ref_non_zero(&subchannel_list->refcount);
193
- if (subchannel_list->tracer->enabled()) {
194
- const gpr_atm count = gpr_atm_acq_load(&subchannel_list->refcount.count);
195
- gpr_log(GPR_DEBUG, "[%s %p] subchannel_list %p REF %lu->%lu (%s)",
196
- subchannel_list->tracer->name(), subchannel_list->policy,
197
- subchannel_list, static_cast<unsigned long>(count - 1),
198
- static_cast<unsigned long>(count), reason);
199
- }
200
- }
201
-
202
- void grpc_lb_subchannel_list_unref(grpc_lb_subchannel_list* subchannel_list,
203
- const char* reason) {
204
- const bool done = gpr_unref(&subchannel_list->refcount);
205
- if (subchannel_list->tracer->enabled()) {
206
- const gpr_atm count = gpr_atm_acq_load(&subchannel_list->refcount.count);
207
- gpr_log(GPR_DEBUG, "[%s %p] subchannel_list %p UNREF %lu->%lu (%s)",
208
- subchannel_list->tracer->name(), subchannel_list->policy,
209
- subchannel_list, static_cast<unsigned long>(count + 1),
210
- static_cast<unsigned long>(count), reason);
211
- }
212
- if (done) {
213
- subchannel_list_destroy(subchannel_list);
214
- }
215
- }
216
-
217
- static void subchannel_data_cancel_connectivity_watch(
218
- grpc_lb_subchannel_data* sd, const char* reason) {
219
- if (sd->subchannel_list->tracer->enabled()) {
220
- gpr_log(GPR_DEBUG,
221
- "[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
222
- " (subchannel %p): canceling connectivity watch (%s)",
223
- sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
224
- sd->subchannel_list,
225
- static_cast<size_t>(sd - sd->subchannel_list->subchannels),
226
- sd->subchannel_list->num_subchannels, sd->subchannel, reason);
227
- }
228
- grpc_subchannel_notify_on_state_change(sd->subchannel, nullptr, nullptr,
229
- &sd->connectivity_changed_closure);
230
- }
231
-
232
- void grpc_lb_subchannel_list_shutdown_and_unref(
233
- grpc_lb_subchannel_list* subchannel_list, const char* reason) {
234
- if (subchannel_list->tracer->enabled()) {
235
- gpr_log(GPR_DEBUG, "[%s %p] Shutting down subchannel_list %p (%s)",
236
- subchannel_list->tracer->name(), subchannel_list->policy,
237
- subchannel_list, reason);
238
- }
239
- GPR_ASSERT(!subchannel_list->shutting_down);
240
- subchannel_list->shutting_down = true;
241
- for (size_t i = 0; i < subchannel_list->num_subchannels; i++) {
242
- grpc_lb_subchannel_data* sd = &subchannel_list->subchannels[i];
243
- // If there's a pending notification for this subchannel, cancel it;
244
- // the callback is responsible for unreffing the subchannel.
245
- // Otherwise, unref the subchannel directly.
246
- if (sd->connectivity_notification_pending) {
247
- subchannel_data_cancel_connectivity_watch(sd, reason);
248
- } else if (sd->subchannel != nullptr) {
249
- grpc_lb_subchannel_data_unref_subchannel(sd, reason);
250
- }
251
- }
252
- grpc_lb_subchannel_list_unref(subchannel_list, reason);
253
- }