grpc 1.27.0.pre1 → 1.27.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +2 -4
  3. data/src/core/ext/filters/client_channel/client_channel.cc +20 -0
  4. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +30 -15
  5. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +2 -3
  6. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +7 -0
  7. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -18
  8. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +19 -24
  9. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +1 -2
  10. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -4
  11. data/src/core/ext/filters/client_channel/server_address.cc +9 -6
  12. data/src/core/ext/filters/client_channel/server_address.h +10 -3
  13. data/src/ruby/lib/grpc/version.rb +1 -1
  14. data/third_party/abseil-cpp/absl/base/attributes.h +13 -1
  15. data/third_party/abseil-cpp/absl/base/config.h +45 -2
  16. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +3 -2
  17. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +4 -1
  18. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +15 -13
  19. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +12 -0
  20. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +9 -0
  21. data/third_party/abseil-cpp/absl/base/options.h +7 -2
  22. data/third_party/abseil-cpp/absl/numeric/int128.cc +2 -2
  23. data/third_party/abseil-cpp/absl/numeric/int128.h +1 -1
  24. data/third_party/abseil-cpp/absl/strings/ascii.cc +3 -3
  25. data/third_party/abseil-cpp/absl/strings/ascii.h +4 -3
  26. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +2 -2
  27. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +4 -2
  28. data/third_party/abseil-cpp/absl/strings/numbers.cc +54 -5
  29. data/third_party/abseil-cpp/absl/strings/numbers.h +6 -3
  30. data/third_party/abseil-cpp/absl/strings/string_view.h +12 -13
  31. metadata +32 -34
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +0 -89
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a004003f8e51e315cbdddf21e89a4577f4dd516120eaf9c90c922b13fac86595
4
- data.tar.gz: 551a605d59295b6dd8074325f8fa25431e96c1e88c990a2ab820ab5c5a0cd651
3
+ metadata.gz: e65bf7171da3828dbf6a661fe4c66b63cb496b3c89a5fda1b2286bf90228347a
4
+ data.tar.gz: 53523643c9af2fa93b43d990d3d609c2f0c67cce52530ffd562d20d14abb2ee9
5
5
  SHA512:
6
- metadata.gz: ae194974d47d46172497c86e1ca6a69abe029606b63aed5b15b2b92109b01aa6177a7359d9b17a0ac7d731d0e9bdeefe735d7dfe0c596f416bd9a1ff3bf86994
7
- data.tar.gz: f852a15617ad5d721435b73abe1473bbf9a1ee39532a33e9fc004b3fab0d994887922662e4f8bda5263ce0a7b9163bc7a1877658afe9f5e0e87c7530a010ab0a
6
+ metadata.gz: 47040056ce12ab490b259ca8e593bc891a946d287a138891aa0dd70cbbf64ec9a4e430fabd8c75bbc10589350058faebeadeb28473e520cb7e6161cd3f37bf5d
7
+ data.tar.gz: 1c4d256f19741bd6725c068443d74f6e1058470395d077e9a739fa5e3ee96ee803df4b5cf9926f7182897b931de499114f436ee193df6473782a42b4fbff8df2
data/Makefile CHANGED
@@ -470,8 +470,8 @@ Q = @
470
470
  endif
471
471
 
472
472
  CORE_VERSION = 9.0.0
473
- CPP_VERSION = 1.27.0-pre1
474
- CSHARP_VERSION = 2.27.0-pre1
473
+ CPP_VERSION = 1.27.0
474
+ CSHARP_VERSION = 2.27.0
475
475
 
476
476
  CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
477
477
  CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
@@ -4273,7 +4273,6 @@ LIBGRPC_SRC = \
4273
4273
  src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc \
4274
4274
  src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc \
4275
4275
  src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc \
4276
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc \
4277
4276
  src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c \
4278
4277
  src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \
4279
4278
  src/core/ext/filters/client_channel/lb_policy/xds/cds.cc \
@@ -5710,7 +5709,6 @@ LIBGRPC_UNSECURE_SRC = \
5710
5709
  src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc \
5711
5710
  src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc \
5712
5711
  src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
5713
- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc \
5714
5712
  src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
5715
5713
  src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
5716
5714
  src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \
@@ -1638,6 +1638,26 @@ void ChannelData::ProcessLbPolicy(
1638
1638
  grpc_channel_args_find(resolver_result.args, GRPC_ARG_LB_POLICY_NAME);
1639
1639
  local_policy_name = grpc_channel_arg_get_string(channel_arg);
1640
1640
  }
1641
+ // Special case: If at least one balancer address is present, we use
1642
+ // the grpclb policy, regardless of what the resolver has returned.
1643
+ bool found_balancer_address = false;
1644
+ for (size_t i = 0; i < resolver_result.addresses.size(); ++i) {
1645
+ const ServerAddress& address = resolver_result.addresses[i];
1646
+ if (address.IsBalancer()) {
1647
+ found_balancer_address = true;
1648
+ break;
1649
+ }
1650
+ }
1651
+ if (found_balancer_address) {
1652
+ if (local_policy_name != nullptr &&
1653
+ strcmp(local_policy_name, "grpclb") != 0) {
1654
+ gpr_log(GPR_INFO,
1655
+ "resolver requested LB policy %s but provided at least one "
1656
+ "balancer address -- forcing use of grpclb LB policy",
1657
+ local_policy_name);
1658
+ }
1659
+ local_policy_name = "grpclb";
1660
+ }
1641
1661
  // Use pick_first if nothing was specified and we didn't select grpclb
1642
1662
  // above.
1643
1663
  lb_policy_name->reset(gpr_strdup(
@@ -73,7 +73,6 @@
73
73
  #include "src/core/ext/filters/client_channel/client_channel.h"
74
74
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h"
75
75
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
76
- #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
77
76
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h"
78
77
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h"
79
78
  #include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
@@ -1268,11 +1267,25 @@ void GrpcLb::BalancerCallState::OnBalancerStatusReceivedLocked(
1268
1267
  // helper code for creating balancer channel
1269
1268
  //
1270
1269
 
1271
- ServerAddressList ExtractBalancerAddresses(const grpc_channel_args& args) {
1272
- const ServerAddressList* addresses =
1273
- FindGrpclbBalancerAddressesInChannelArgs(args);
1274
- if (addresses != nullptr) return *addresses;
1275
- return ServerAddressList();
1270
+ ServerAddressList ExtractBalancerAddresses(const ServerAddressList& addresses) {
1271
+ ServerAddressList balancer_addresses;
1272
+ for (size_t i = 0; i < addresses.size(); ++i) {
1273
+ if (addresses[i].IsBalancer()) {
1274
+ // Strip out the is_balancer channel arg, since we don't want to
1275
+ // recursively use the grpclb policy in the channel used to talk to
1276
+ // the balancers. Note that we do NOT strip out the balancer_name
1277
+ // channel arg, since we need that to set the authority correctly
1278
+ // to talk to the balancers.
1279
+ static const char* args_to_remove[] = {
1280
+ GRPC_ARG_ADDRESS_IS_BALANCER,
1281
+ };
1282
+ balancer_addresses.emplace_back(
1283
+ addresses[i].address(),
1284
+ grpc_channel_args_copy_and_remove(addresses[i].args(), args_to_remove,
1285
+ GPR_ARRAY_SIZE(args_to_remove)));
1286
+ }
1287
+ }
1288
+ return balancer_addresses;
1276
1289
  }
1277
1290
 
1278
1291
  /* Returns the channel args for the LB channel, used to create a bidirectional
@@ -1478,25 +1491,27 @@ void GrpcLb::UpdateLocked(UpdateArgs args) {
1478
1491
  // helpers for UpdateLocked()
1479
1492
  //
1480
1493
 
1481
- ServerAddressList AddNullLbTokenToAddresses(
1482
- const ServerAddressList& addresses) {
1494
+ // Returns the backend addresses extracted from the given addresses.
1495
+ ServerAddressList ExtractBackendAddresses(const ServerAddressList& addresses) {
1483
1496
  static const char* lb_token = "";
1484
1497
  grpc_arg arg = grpc_channel_arg_pointer_create(
1485
1498
  const_cast<char*>(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN),
1486
1499
  const_cast<char*>(lb_token), &lb_token_arg_vtable);
1487
- ServerAddressList addresses_out;
1500
+ ServerAddressList backend_addresses;
1488
1501
  for (size_t i = 0; i < addresses.size(); ++i) {
1489
- addresses_out.emplace_back(
1490
- addresses[i].address(),
1491
- grpc_channel_args_copy_and_add(addresses[i].args(), &arg, 1));
1502
+ if (!addresses[i].IsBalancer()) {
1503
+ backend_addresses.emplace_back(
1504
+ addresses[i].address(),
1505
+ grpc_channel_args_copy_and_add(addresses[i].args(), &arg, 1));
1506
+ }
1492
1507
  }
1493
- return addresses_out;
1508
+ return backend_addresses;
1494
1509
  }
1495
1510
 
1496
1511
  void GrpcLb::ProcessAddressesAndChannelArgsLocked(
1497
1512
  const ServerAddressList& addresses, const grpc_channel_args& args) {
1498
1513
  // Update fallback address list.
1499
- fallback_backend_addresses_ = AddNullLbTokenToAddresses(addresses);
1514
+ fallback_backend_addresses_ = ExtractBackendAddresses(addresses);
1500
1515
  // Make sure that GRPC_ARG_LB_POLICY_NAME is set in channel args,
1501
1516
  // since we use this to trigger the client_load_reporting filter.
1502
1517
  static const char* args_to_remove[] = {GRPC_ARG_LB_POLICY_NAME};
@@ -1506,7 +1521,7 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked(
1506
1521
  args_ = grpc_channel_args_copy_and_add_and_remove(
1507
1522
  &args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), &new_arg, 1);
1508
1523
  // Construct args for balancer channel.
1509
- ServerAddressList balancer_addresses = ExtractBalancerAddresses(args);
1524
+ ServerAddressList balancer_addresses = ExtractBalancerAddresses(addresses);
1510
1525
  grpc_channel_args* lb_channel_args = BuildBalancerChannelArgs(
1511
1526
  balancer_addresses, response_generator_.get(), &args);
1512
1527
  // Create balancer channel if needed.
@@ -27,7 +27,6 @@
27
27
  #include <grpc/support/string_util.h>
28
28
 
29
29
  #include "src/core/ext/filters/client_channel/client_channel.h"
30
- #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
31
30
  #include "src/core/ext/filters/client_channel/server_address.h"
32
31
  #include "src/core/lib/channel/channel_args.h"
33
32
  #include "src/core/lib/gpr/string.h"
@@ -56,8 +55,8 @@ RefCountedPtr<TargetAuthorityTable> CreateTargetAuthorityTable(
56
55
  grpc_sockaddr_to_string(&addr_str, &addresses[i].address(), true) > 0);
57
56
  target_authority_entries[i].key = grpc_slice_from_copied_string(addr_str);
58
57
  gpr_free(addr_str);
59
- const char* balancer_name =
60
- FindGrpclbBalancerNameInChannelArgs(*addresses[i].args());
58
+ char* balancer_name = grpc_channel_arg_get_string(grpc_channel_args_find(
59
+ addresses[i].args(), GRPC_ARG_ADDRESS_BALANCER_NAME));
61
60
  target_authority_entries[i].value.reset(gpr_strdup(balancer_name));
62
61
  }
63
62
  RefCountedPtr<TargetAuthorityTable> target_authority_table =
@@ -370,6 +370,13 @@ SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
370
370
  GRPC_ARG_SERVICE_CONFIG};
371
371
  // Create a subchannel for each address.
372
372
  for (size_t i = 0; i < addresses.size(); i++) {
373
+ // TODO(roth): we should ideally hide this from the LB policy code. In
374
+ // principle, if we're dealing with this special case in the client_channel
375
+ // code for selecting grpclb, then we should also strip out these addresses
376
+ // there if we're not using grpclb.
377
+ if (addresses[i].IsBalancer()) {
378
+ continue;
379
+ }
373
380
  InlinedVector<grpc_arg, 3> args_to_add;
374
381
  const size_t subchannel_address_arg_index = args_to_add.size();
375
382
  args_to_add.emplace_back(
@@ -30,7 +30,6 @@
30
30
  #include <address_sorting/address_sorting.h>
31
31
 
32
32
  #include "src/core/ext/filters/client_channel/http_connect_handshaker.h"
33
- #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
34
33
  #include "src/core/ext/filters/client_channel/lb_policy_registry.h"
35
34
  #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
36
35
  #include "src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h"
@@ -108,10 +107,8 @@ class AresDnsResolver : public Resolver {
108
107
  grpc_millis last_resolution_timestamp_ = -1;
109
108
  /// retry backoff state
110
109
  BackOff backoff_;
111
- /// currently resolving backend addresses
110
+ /// currently resolving addresses
112
111
  std::unique_ptr<ServerAddressList> addresses_;
113
- /// currently resolving balancer addresses
114
- std::unique_ptr<ServerAddressList> balancer_addresses_;
115
112
  /// currently resolving service config
116
113
  char* service_config_json_ = nullptr;
117
114
  // has shutdown been initiated
@@ -343,11 +340,9 @@ void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
343
340
  r->Unref(DEBUG_LOCATION, "OnResolvedLocked() shutdown");
344
341
  return;
345
342
  }
346
- if (r->addresses_ != nullptr || r->balancer_addresses_ != nullptr) {
343
+ if (r->addresses_ != nullptr) {
347
344
  Result result;
348
- if (r->addresses_ != nullptr) {
349
- result.addresses = std::move(*r->addresses_);
350
- }
345
+ result.addresses = std::move(*r->addresses_);
351
346
  if (r->service_config_json_ != nullptr) {
352
347
  char* service_config_string = ChooseServiceConfig(
353
348
  r->service_config_json_, &result.service_config_error);
@@ -361,16 +356,9 @@ void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
361
356
  }
362
357
  gpr_free(service_config_string);
363
358
  }
364
- InlinedVector<grpc_arg, 1> new_args;
365
- if (r->balancer_addresses_ != nullptr) {
366
- new_args.push_back(
367
- CreateGrpclbBalancerAddressesArg(r->balancer_addresses_.get()));
368
- }
369
- result.args = grpc_channel_args_copy_and_add(
370
- r->channel_args_, new_args.data(), new_args.size());
359
+ result.args = grpc_channel_args_copy(r->channel_args_);
371
360
  r->result_handler()->ReturnResult(std::move(result));
372
361
  r->addresses_.reset();
373
- r->balancer_addresses_.reset();
374
362
  // Reset backoff state so that we start from the beginning when the
375
363
  // next request gets triggered.
376
364
  r->backoff_.Reset();
@@ -449,8 +437,7 @@ void AresDnsResolver::StartResolvingLocked() {
449
437
  GRPC_CLOSURE_INIT(&on_resolved_, OnResolved, this, grpc_schedule_on_exec_ctx);
450
438
  pending_request_ = grpc_dns_lookup_ares_locked(
451
439
  dns_server_, name_to_resolve_, kDefaultPort, interested_parties_,
452
- &on_resolved_, &addresses_,
453
- enable_srv_queries_ ? &balancer_addresses_ : nullptr,
440
+ &on_resolved_, &addresses_, enable_srv_queries_ /* check_grpclb */,
454
441
  request_service_config_ ? &service_config_json_ : nullptr,
455
442
  query_timeout_ms_, combiner());
456
443
  last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
@@ -33,7 +33,6 @@
33
33
  #include <grpc/support/time.h>
34
34
 
35
35
  #include <address_sorting/address_sorting.h>
36
- #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
37
36
  #include "src/core/ext/filters/client_channel/parse_address.h"
38
37
  #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
39
38
  #include "src/core/lib/gpr/string.h"
@@ -61,8 +60,6 @@ struct grpc_ares_request {
61
60
  grpc_closure* on_done;
62
61
  /** the pointer to receive the resolved addresses */
63
62
  std::unique_ptr<grpc_core::ServerAddressList>* addresses_out;
64
- /** the pointer to receive the resolved balancer addresses */
65
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses_out;
66
63
  /** the pointer to receive the service config in JSON */
67
64
  char** service_config_json_out;
68
65
  /** the evernt driver used by this request */
@@ -187,17 +184,17 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/,
187
184
  GRPC_CARES_TRACE_LOG(
188
185
  "request:%p on_hostbyname_done_locked host=%s ARES_SUCCESS", r,
189
186
  hr->host);
190
- std::unique_ptr<ServerAddressList>* address_list_ptr =
191
- hr->is_balancer ? r->balancer_addresses_out : r->addresses_out;
192
- if (*address_list_ptr == nullptr) {
193
- *address_list_ptr = grpc_core::MakeUnique<ServerAddressList>();
187
+ if (*r->addresses_out == nullptr) {
188
+ *r->addresses_out = grpc_core::MakeUnique<ServerAddressList>();
194
189
  }
195
- ServerAddressList& addresses = **address_list_ptr;
190
+ ServerAddressList& addresses = **r->addresses_out;
196
191
  for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) {
197
- grpc_core::InlinedVector<grpc_arg, 1> args_to_add;
192
+ grpc_core::InlinedVector<grpc_arg, 2> args_to_add;
198
193
  if (hr->is_balancer) {
199
- args_to_add.emplace_back(
200
- grpc_core::CreateGrpclbBalancerNameArg(hr->host));
194
+ args_to_add.emplace_back(grpc_channel_arg_integer_create(
195
+ const_cast<char*>(GRPC_ARG_ADDRESS_IS_BALANCER), 1));
196
+ args_to_add.emplace_back(grpc_channel_arg_string_create(
197
+ const_cast<char*>(GRPC_ARG_ADDRESS_BALANCER_NAME), hr->host));
201
198
  }
202
199
  grpc_channel_args* args = grpc_channel_args_copy_and_add(
203
200
  nullptr, args_to_add.data(), args_to_add.size());
@@ -353,7 +350,7 @@ done:
353
350
  void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
354
351
  grpc_ares_request* r, const char* dns_server, const char* name,
355
352
  const char* default_port, grpc_pollset_set* interested_parties,
356
- int query_timeout_ms, grpc_core::Combiner* combiner) {
353
+ bool check_grpclb, int query_timeout_ms, grpc_core::Combiner* combiner) {
357
354
  grpc_error* error = GRPC_ERROR_NONE;
358
355
  grpc_ares_hostbyname_request* hr = nullptr;
359
356
  ares_channel* channel = nullptr;
@@ -428,7 +425,7 @@ void grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
428
425
  /*is_balancer=*/false);
429
426
  ares_gethostbyname(*channel, hr->host, AF_INET, on_hostbyname_done_locked,
430
427
  hr);
431
- if (r->balancer_addresses_out != nullptr) {
428
+ if (check_grpclb) {
432
429
  /* Query the SRV record */
433
430
  grpc_ares_request_ref_locked(r);
434
431
  char* service_name;
@@ -591,8 +588,7 @@ static bool grpc_ares_maybe_resolve_localhost_manually_locked(
591
588
  static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
592
589
  const char* dns_server, const char* name, const char* default_port,
593
590
  grpc_pollset_set* interested_parties, grpc_closure* on_done,
594
- std::unique_ptr<grpc_core::ServerAddressList>* addrs,
595
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addrs,
591
+ std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
596
592
  char** service_config_json, int query_timeout_ms,
597
593
  grpc_core::Combiner* combiner) {
598
594
  grpc_ares_request* r =
@@ -600,7 +596,6 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
600
596
  r->ev_driver = nullptr;
601
597
  r->on_done = on_done;
602
598
  r->addresses_out = addrs;
603
- r->balancer_addresses_out = balancer_addrs;
604
599
  r->service_config_json_out = service_config_json;
605
600
  r->error = GRPC_ERROR_NONE;
606
601
  r->pending_queries = 0;
@@ -623,21 +618,20 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
623
618
  // as to cut down on lookups over the network, especially in tests:
624
619
  // https://github.com/grpc/proposal/pull/79
625
620
  if (target_matches_localhost(name)) {
626
- r->balancer_addresses_out = nullptr;
621
+ check_grpclb = false;
627
622
  r->service_config_json_out = nullptr;
628
623
  }
629
624
  // Look up name using c-ares lib.
630
625
  grpc_dns_lookup_ares_continue_after_check_localhost_and_ip_literals_locked(
631
- r, dns_server, name, default_port, interested_parties, query_timeout_ms,
632
- combiner);
626
+ r, dns_server, name, default_port, interested_parties, check_grpclb,
627
+ query_timeout_ms, combiner);
633
628
  return r;
634
629
  }
635
630
 
636
631
  grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
637
632
  const char* dns_server, const char* name, const char* default_port,
638
633
  grpc_pollset_set* interested_parties, grpc_closure* on_done,
639
- std::unique_ptr<grpc_core::ServerAddressList>* addrs,
640
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addrs,
634
+ std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
641
635
  char** service_config_json, int query_timeout_ms,
642
636
  grpc_core::Combiner* combiner) = grpc_dns_lookup_ares_locked_impl;
643
637
 
@@ -715,6 +709,7 @@ static void on_dns_lookup_done_locked(void* arg, grpc_error* error) {
715
709
  static_cast<grpc_resolved_address*>(gpr_zalloc(
716
710
  sizeof(grpc_resolved_address) * (*resolved_addresses)->naddrs));
717
711
  for (size_t i = 0; i < (*resolved_addresses)->naddrs; ++i) {
712
+ GPR_ASSERT(!(*r->addresses)[i].IsBalancer());
718
713
  memcpy(&(*resolved_addresses)->addrs[i], &(*r->addresses)[i].address(),
719
714
  sizeof(grpc_resolved_address));
720
715
  }
@@ -741,9 +736,9 @@ static void grpc_resolve_address_invoke_dns_lookup_ares_locked(
741
736
  grpc_schedule_on_exec_ctx);
742
737
  r->ares_request = grpc_dns_lookup_ares_locked(
743
738
  nullptr /* dns_server */, r->name, r->default_port, r->interested_parties,
744
- &r->on_dns_lookup_done_locked, &r->addresses,
745
- nullptr /* balancer_addresses */, nullptr /* service_config_json */,
746
- GRPC_DNS_ARES_DEFAULT_QUERY_TIMEOUT_MS, r->combiner);
739
+ &r->on_dns_lookup_done_locked, &r->addresses, false /* check_grpclb */,
740
+ nullptr /* service_config_json */, GRPC_DNS_ARES_DEFAULT_QUERY_TIMEOUT_MS,
741
+ r->combiner);
747
742
  }
748
743
 
749
744
  static void grpc_resolve_address_ares_impl(const char* name,
@@ -63,8 +63,7 @@ extern void (*grpc_resolve_address_ares)(const char* name,
63
63
  extern grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
64
64
  const char* dns_server, const char* name, const char* default_port,
65
65
  grpc_pollset_set* interested_parties, grpc_closure* on_done,
66
- std::unique_ptr<grpc_core::ServerAddressList>* addresses,
67
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addresses,
66
+ std::unique_ptr<grpc_core::ServerAddressList>* addresses, bool check_grpclb,
68
67
  char** service_config_json, int query_timeout_ms,
69
68
  grpc_core::Combiner* combiner);
70
69
 
@@ -29,8 +29,7 @@ struct grpc_ares_request {
29
29
  static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
30
30
  const char* dns_server, const char* name, const char* default_port,
31
31
  grpc_pollset_set* interested_parties, grpc_closure* on_done,
32
- std::unique_ptr<grpc_core::ServerAddressList>* addrs,
33
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addrs,
32
+ std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
34
33
  char** service_config_json, int query_timeout_ms,
35
34
  grpc_core::Combiner* combiner) {
36
35
  return NULL;
@@ -39,8 +38,7 @@ static grpc_ares_request* grpc_dns_lookup_ares_locked_impl(
39
38
  grpc_ares_request* (*grpc_dns_lookup_ares_locked)(
40
39
  const char* dns_server, const char* name, const char* default_port,
41
40
  grpc_pollset_set* interested_parties, grpc_closure* on_done,
42
- std::unique_ptr<grpc_core::ServerAddressList>* addrs,
43
- std::unique_ptr<grpc_core::ServerAddressList>* balancer_addrs,
41
+ std::unique_ptr<grpc_core::ServerAddressList>* addrs, bool check_grpclb,
44
42
  char** service_config_json, int query_timeout_ms,
45
43
  grpc_core::Combiner* combiner) = grpc_dns_lookup_ares_locked_impl;
46
44
 
@@ -37,12 +37,15 @@ ServerAddress::ServerAddress(const void* address, size_t address_len,
37
37
  address_.len = static_cast<socklen_t>(address_len);
38
38
  }
39
39
 
40
- int ServerAddress::Cmp(const ServerAddress& other) const {
41
- if (address_.len > other.address_.len) return 1;
42
- if (address_.len < other.address_.len) return -1;
43
- int retval = memcmp(address_.addr, other.address_.addr, address_.len);
44
- if (retval != 0) return retval;
45
- return grpc_channel_args_compare(args_, other.args_);
40
+ bool ServerAddress::operator==(const ServerAddress& other) const {
41
+ return address_.len == other.address_.len &&
42
+ memcmp(address_.addr, other.address_.addr, address_.len) == 0 &&
43
+ grpc_channel_args_compare(args_, other.args_) == 0;
44
+ }
45
+
46
+ bool ServerAddress::IsBalancer() const {
47
+ return grpc_channel_arg_get_bool(
48
+ grpc_channel_args_find(args_, GRPC_ARG_ADDRESS_IS_BALANCER), false);
46
49
  }
47
50
 
48
51
  } // namespace grpc_core
@@ -25,6 +25,13 @@
25
25
  #include "src/core/lib/gprpp/inlined_vector.h"
26
26
  #include "src/core/lib/iomgr/resolve_address.h"
27
27
 
28
+ // Channel arg key for a bool indicating whether an address is a grpclb
29
+ // load balancer (as opposed to a backend).
30
+ #define GRPC_ARG_ADDRESS_IS_BALANCER "grpc.address_is_balancer"
31
+
32
+ // Channel arg key for a string indicating an address's balancer name.
33
+ #define GRPC_ARG_ADDRESS_BALANCER_NAME "grpc.address_balancer_name"
34
+
28
35
  namespace grpc_core {
29
36
 
30
37
  //
@@ -66,13 +73,13 @@ class ServerAddress {
66
73
  return *this;
67
74
  }
68
75
 
69
- bool operator==(const ServerAddress& other) const { return Cmp(other) == 0; }
70
-
71
- int Cmp(const ServerAddress& other) const;
76
+ bool operator==(const ServerAddress& other) const;
72
77
 
73
78
  const grpc_resolved_address& address() const { return address_; }
74
79
  const grpc_channel_args* args() const { return args_; }
75
80
 
81
+ bool IsBalancer() const;
82
+
76
83
  private:
77
84
  grpc_resolved_address address_;
78
85
  grpc_channel_args* args_;
@@ -14,5 +14,5 @@
14
14
 
15
15
  # GRPC contains the General RPC module.
16
16
  module GRPC
17
- VERSION = '1.27.0.pre1'
17
+ VERSION = '1.27.0'
18
18
  end
@@ -563,7 +563,19 @@
563
563
 
564
564
  // ABSL_ATTRIBUTE_PACKED
565
565
  //
566
- // Prevents the compiler from padding a structure to natural alignment
566
+ // Instructs the compiler not to use natural alignment for a tagged data
567
+ // structure, but instead to reduce its alignment to 1. This attribute can
568
+ // either be applied to members of a structure or to a structure in its
569
+ // entirety. Applying this attribute (judiciously) to a structure in its
570
+ // entirety to optimize the memory footprint of very commonly-used structs is
571
+ // fine. Do not apply this attribute to a structure in its entirety if the
572
+ // purpose is to control the offsets of the members in the structure. Instead,
573
+ // apply this attribute only to structure members that need it.
574
+ //
575
+ // When applying ABSL_ATTRIBUTE_PACKED only to specific structure members the
576
+ // natural alignment of structure members not annotated is preserved. Aligned
577
+ // member accesses are faster than non-aligned member accesses even if the
578
+ // targeted microprosessor supports non-aligned accesses.
567
579
  #if ABSL_HAVE_ATTRIBUTE(packed) || (defined(__GNUC__) && !defined(__clang__))
568
580
  #define ABSL_ATTRIBUTE_PACKED __attribute__((__packed__))
569
581
  #else
@@ -66,6 +66,10 @@
66
66
  #include "absl/base/options.h"
67
67
  #include "absl/base/policy_checks.h"
68
68
 
69
+ // Helper macro to convert a CPP variable to a string literal.
70
+ #define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
71
+ #define ABSL_INTERNAL_TOKEN_STR(x) ABSL_INTERNAL_DO_TOKEN_STR(x)
72
+
69
73
  // -----------------------------------------------------------------------------
70
74
  // Abseil namespace annotations
71
75
  // -----------------------------------------------------------------------------
@@ -98,8 +102,6 @@
98
102
  // Check that ABSL_OPTION_INLINE_NAMESPACE_NAME is neither "head" nor ""
99
103
  #if defined(__cplusplus) && ABSL_OPTION_USE_INLINE_NAMESPACE == 1
100
104
 
101
- #define ABSL_INTERNAL_DO_TOKEN_STR(x) #x
102
- #define ABSL_INTERNAL_TOKEN_STR(x) ABSL_INTERNAL_DO_TOKEN_STR(x)
103
105
  #define ABSL_INTERNAL_INLINE_NAMESPACE_STR \
104
106
  ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME)
105
107
 
@@ -617,6 +619,47 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
617
619
  #define ABSL_INTERNAL_MSVC_2017_DBG_MODE
618
620
  #endif
619
621
 
622
+ // ABSL_INTERNAL_MANGLED_NS
623
+ // ABSL_INTERNAL_MANGLED_BACKREFERENCE
624
+ //
625
+ // Internal macros for building up mangled names in our internal fork of CCTZ.
626
+ // This implementation detail is only needed and provided for the MSVC build.
627
+ //
628
+ // These macros both expand to string literals. ABSL_INTERNAL_MANGLED_NS is
629
+ // the mangled spelling of the `absl` namespace, and
630
+ // ABSL_INTERNAL_MANGLED_BACKREFERENCE is a back-reference integer representing
631
+ // the proper count to skip past the CCTZ fork namespace names. (This number
632
+ // is one larger when there is an inline namespace name to skip.)
633
+ #if defined(_MSC_VER)
634
+ #if ABSL_OPTION_USE_INLINE_NAMESPACE == 0
635
+ #define ABSL_INTERNAL_MANGLED_NS "absl"
636
+ #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "5"
637
+ #else
638
+ #define ABSL_INTERNAL_MANGLED_NS \
639
+ ABSL_INTERNAL_TOKEN_STR(ABSL_OPTION_INLINE_NAMESPACE_NAME) "@absl"
640
+ #define ABSL_INTERNAL_MANGLED_BACKREFERENCE "6"
641
+ #endif
642
+ #endif
643
+
620
644
  #undef ABSL_INTERNAL_HAS_KEYWORD
621
645
 
646
+ // ABSL_DLL
647
+ //
648
+ // When building Abseil as a DLL, this macro expands to `__declspec(dllexport)`
649
+ // so we can annotate symbols appropriately as being exported. When used in
650
+ // headers consuming a DLL, this macro expands to `__declspec(dllimport)` so
651
+ // that consumers know the symbol is defined inside the DLL. In all other cases,
652
+ // the macro expands to nothing.
653
+ #if defined(_MSC_VER)
654
+ #if defined(ABSL_BUILD_DLL)
655
+ #define ABSL_DLL __declspec(dllexport)
656
+ #elif defined(ABSL_CONSUME_DLL)
657
+ #define ABSL_DLL __declspec(dllimport)
658
+ #else
659
+ #define ABSL_DLL
660
+ #endif
661
+ #else
662
+ #define ABSL_DLL
663
+ #endif // defined(_MSC_VER)
664
+
622
665
  #endif // ABSL_BASE_CONFIG_H_
@@ -225,8 +225,9 @@ bool RawLoggingFullySupported() {
225
225
  #endif // !ABSL_LOW_LEVEL_WRITE_SUPPORTED
226
226
  }
227
227
 
228
- ABSL_CONST_INIT absl::base_internal::AtomicHook<InternalLogFunction>
229
- internal_log_function(DefaultInternalLog);
228
+ ABSL_CONST_INIT ABSL_DLL
229
+ absl::base_internal::AtomicHook<InternalLogFunction>
230
+ internal_log_function(DefaultInternalLog);
230
231
 
231
232
  void RegisterInternalLogFunction(InternalLogFunction func) {
232
233
  internal_log_function.Store(func);
@@ -22,9 +22,11 @@
22
22
  #include <string>
23
23
 
24
24
  #include "absl/base/attributes.h"
25
+ #include "absl/base/config.h"
25
26
  #include "absl/base/internal/atomic_hook.h"
26
27
  #include "absl/base/log_severity.h"
27
28
  #include "absl/base/macros.h"
29
+ #include "absl/base/optimization.h"
28
30
  #include "absl/base/port.h"
29
31
 
30
32
  // This is similar to LOG(severity) << format..., but
@@ -168,7 +170,8 @@ using InternalLogFunction = void (*)(absl::LogSeverity severity,
168
170
  const char* file, int line,
169
171
  const std::string& message);
170
172
 
171
- extern base_internal::AtomicHook<InternalLogFunction> internal_log_function;
173
+ ABSL_DLL extern base_internal::AtomicHook<InternalLogFunction>
174
+ internal_log_function;
172
175
 
173
176
  void RegisterInternalLogFunction(InternalLogFunction func);
174
177
 
@@ -58,10 +58,6 @@ namespace absl {
58
58
  ABSL_NAMESPACE_BEGIN
59
59
  namespace base_internal {
60
60
 
61
- static once_flag init_system_info_once;
62
- static int num_cpus = 0;
63
- static double nominal_cpu_frequency = 1.0; // 0.0 might be dangerous.
64
-
65
61
  static int GetNumCPUs() {
66
62
  #if defined(__myriad2__)
67
63
  return 1;
@@ -265,21 +261,27 @@ static double GetNominalCPUFrequency() {
265
261
 
266
262
  #endif
267
263
 
268
- // InitializeSystemInfo() may be called before main() and before
269
- // malloc is properly initialized, therefore this must not allocate
270
- // memory.
271
- static void InitializeSystemInfo() {
272
- num_cpus = GetNumCPUs();
273
- nominal_cpu_frequency = GetNominalCPUFrequency();
274
- }
264
+ ABSL_CONST_INIT static once_flag init_num_cpus_once;
265
+ ABSL_CONST_INIT static int num_cpus = 0;
275
266
 
267
+ // NumCPUs() may be called before main() and before malloc is properly
268
+ // initialized, therefore this must not allocate memory.
276
269
  int NumCPUs() {
277
- base_internal::LowLevelCallOnce(&init_system_info_once, InitializeSystemInfo);
270
+ base_internal::LowLevelCallOnce(
271
+ &init_num_cpus_once, []() { num_cpus = GetNumCPUs(); });
278
272
  return num_cpus;
279
273
  }
280
274
 
275
+ // A default frequency of 0.0 might be dangerous if it is used in division.
276
+ ABSL_CONST_INIT static once_flag init_nominal_cpu_frequency_once;
277
+ ABSL_CONST_INIT static double nominal_cpu_frequency = 1.0;
278
+
279
+ // NominalCPUFrequency() may be called before main() and before malloc is
280
+ // properly initialized, therefore this must not allocate memory.
281
281
  double NominalCPUFrequency() {
282
- base_internal::LowLevelCallOnce(&init_system_info_once, InitializeSystemInfo);
282
+ base_internal::LowLevelCallOnce(
283
+ &init_nominal_cpu_frequency_once,
284
+ []() { nominal_cpu_frequency = GetNominalCPUFrequency(); });
283
285
  return nominal_cpu_frequency;
284
286
  }
285
287
 
@@ -113,6 +113,18 @@ void SetCurrentThreadIdentity(
113
113
  #endif
114
114
  }
115
115
 
116
+ #if ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_TLS || \
117
+ ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_CPP11
118
+
119
+ // Please see the comment on `CurrentThreadIdentityIfPresent` in
120
+ // thread_identity.h. Because DLLs cannot expose thread_local variables in
121
+ // headers, we opt for the correct-but-slower option of placing the definition
122
+ // of this function only in a translation unit inside DLL.
123
+ #if defined(ABSL_BUILD_DLL) || defined(ABSL_CONSUME_DLL)
124
+ ThreadIdentity* CurrentThreadIdentityIfPresent() { return thread_identity_ptr; }
125
+ #endif
126
+ #endif
127
+
116
128
  void ClearCurrentThreadIdentity() {
117
129
  #if ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_TLS || \
118
130
  ABSL_THREAD_IDENTITY_MODE == ABSL_THREAD_IDENTITY_MODE_USE_CPP11
@@ -30,6 +30,7 @@
30
30
  #include <atomic>
31
31
  #include <cstdint>
32
32
 
33
+ #include "absl/base/config.h"
33
34
  #include "absl/base/internal/per_thread_tls.h"
34
35
 
35
36
  namespace absl {
@@ -234,9 +235,17 @@ ABSL_CONST_INIT extern thread_local ThreadIdentity* thread_identity_ptr;
234
235
  #error Thread-local storage not detected on this platform
235
236
  #endif
236
237
 
238
+ // thread_local variables cannot be in headers exposed by DLLs. However, it is
239
+ // important for performance reasons in general that
240
+ // `CurrentThreadIdentityIfPresent` be inlined. This is not possible across a
241
+ // DLL boundary so, with DLLs, we opt to have the function not be inlined. Note
242
+ // that `CurrentThreadIdentityIfPresent` is declared above so we can exclude
243
+ // this entire inline definition when compiling as a DLL.
244
+ #if !defined(ABSL_BUILD_DLL) && !defined(ABSL_CONSUME_DLL)
237
245
  inline ThreadIdentity* CurrentThreadIdentityIfPresent() {
238
246
  return thread_identity_ptr;
239
247
  }
248
+ #endif
240
249
 
241
250
  #elif ABSL_THREAD_IDENTITY_MODE != \
242
251
  ABSL_THREAD_IDENTITY_MODE_USE_POSIX_SETSPECIFIC
@@ -66,7 +66,13 @@
66
66
  // NOTE: the defaults within this file all assume that Abseil can select the
67
67
  // proper Abseil implementation at compile-time, which will not be sufficient
68
68
  // to guarantee ABI stability to package managers.
69
- //
69
+
70
+ // Include a standard library header to allow configuration based on the
71
+ // standard library in use.
72
+ #ifdef __cplusplus
73
+ #include <ciso646>
74
+ #endif
75
+
70
76
  // -----------------------------------------------------------------------------
71
77
  // Type Compatibility Options
72
78
  // -----------------------------------------------------------------------------
@@ -158,7 +164,6 @@
158
164
 
159
165
  #define ABSL_OPTION_USE_STD_STRING_VIEW 2
160
166
 
161
-
162
167
  // ABSL_OPTION_USE_STD_VARIANT
163
168
  //
164
169
  // This option controls whether absl::variant is implemented as an alias to
@@ -25,8 +25,8 @@
25
25
  namespace absl {
26
26
  ABSL_NAMESPACE_BEGIN
27
27
 
28
- const uint128 kuint128max = MakeUint128(std::numeric_limits<uint64_t>::max(),
29
- std::numeric_limits<uint64_t>::max());
28
+ ABSL_DLL const uint128 kuint128max = MakeUint128(
29
+ std::numeric_limits<uint64_t>::max(), std::numeric_limits<uint64_t>::max());
30
30
 
31
31
  namespace {
32
32
 
@@ -234,7 +234,7 @@ class
234
234
  // Prefer to use the constexpr `Uint128Max()`.
235
235
  //
236
236
  // TODO(absl-team) deprecate kuint128max once migration tool is released.
237
- extern const uint128 kuint128max;
237
+ ABSL_DLL extern const uint128 kuint128max;
238
238
 
239
239
  // allow uint128 to be logged
240
240
  std::ostream& operator<<(std::ostream& os, uint128 v);
@@ -57,7 +57,7 @@ namespace ascii_internal {
57
57
  // of these bits is tightly coupled to this implementation, the individual bits
58
58
  // are not named. Note that bitfields for all characters above ASCII 127 are
59
59
  // zero-initialized.
60
- const unsigned char kPropertyBits[256] = {
60
+ ABSL_DLL const unsigned char kPropertyBits[256] = {
61
61
  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // 0x00
62
62
  0x40, 0x68, 0x48, 0x48, 0x48, 0x48, 0x40, 0x40,
63
63
  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // 0x10
@@ -79,7 +79,7 @@ const unsigned char kPropertyBits[256] = {
79
79
  // Array of characters for the ascii_tolower() function. For values 'A'
80
80
  // through 'Z', return the lower-case character; otherwise, return the
81
81
  // identity of the passed character.
82
- const char kToLower[256] = {
82
+ ABSL_DLL const char kToLower[256] = {
83
83
  '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
84
84
  '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
85
85
  '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
@@ -117,7 +117,7 @@ const char kToLower[256] = {
117
117
  // Array of characters for the ascii_toupper() function. For values 'a'
118
118
  // through 'z', return the upper-case character; otherwise, return the
119
119
  // identity of the passed character.
120
- const char kToUpper[256] = {
120
+ ABSL_DLL const char kToUpper[256] = {
121
121
  '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
122
122
  '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
123
123
  '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
@@ -56,6 +56,7 @@
56
56
  #include <string>
57
57
 
58
58
  #include "absl/base/attributes.h"
59
+ #include "absl/base/config.h"
59
60
  #include "absl/strings/string_view.h"
60
61
 
61
62
  namespace absl {
@@ -63,13 +64,13 @@ ABSL_NAMESPACE_BEGIN
63
64
  namespace ascii_internal {
64
65
 
65
66
  // Declaration for an array of bitfields holding character information.
66
- extern const unsigned char kPropertyBits[256];
67
+ ABSL_DLL extern const unsigned char kPropertyBits[256];
67
68
 
68
69
  // Declaration for the array of characters to upper-case characters.
69
- extern const char kToUpper[256];
70
+ ABSL_DLL extern const char kToUpper[256];
70
71
 
71
72
  // Declaration for the array of characters to lower-case characters.
72
- extern const char kToLower[256];
73
+ ABSL_DLL extern const char kToLower[256];
73
74
 
74
75
  } // namespace ascii_internal
75
76
 
@@ -158,12 +158,12 @@ const uint32_t* LargePowerOfFiveData(int i) {
158
158
  int LargePowerOfFiveSize(int i) { return 2 * i; }
159
159
  } // namespace
160
160
 
161
- const uint32_t kFiveToNth[14] = {
161
+ ABSL_DLL const uint32_t kFiveToNth[14] = {
162
162
  1, 5, 25, 125, 625, 3125, 15625,
163
163
  78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125,
164
164
  };
165
165
 
166
- const uint32_t kTenToNth[10] = {
166
+ ABSL_DLL const uint32_t kTenToNth[10] = {
167
167
  1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000,
168
168
  };
169
169
 
@@ -20,6 +20,7 @@
20
20
  #include <iostream>
21
21
  #include <string>
22
22
 
23
+ #include "absl/base/config.h"
23
24
  #include "absl/strings/ascii.h"
24
25
  #include "absl/strings/internal/charconv_parse.h"
25
26
  #include "absl/strings/string_view.h"
@@ -33,8 +34,9 @@ constexpr int kMaxSmallPowerOfFive = 13;
33
34
  // The largest power that 10 that can be raised to, and still fit in a uint32_t.
34
35
  constexpr int kMaxSmallPowerOfTen = 9;
35
36
 
36
- extern const uint32_t kFiveToNth[kMaxSmallPowerOfFive + 1];
37
- extern const uint32_t kTenToNth[kMaxSmallPowerOfTen + 1];
37
+ ABSL_DLL extern const uint32_t
38
+ kFiveToNth[kMaxSmallPowerOfFive + 1];
39
+ ABSL_DLL extern const uint32_t kTenToNth[kMaxSmallPowerOfTen + 1];
38
40
 
39
41
  // Large, fixed-width unsigned integer.
40
42
  //
@@ -30,6 +30,7 @@
30
30
  #include <memory>
31
31
  #include <utility>
32
32
 
33
+ #include "absl/base/attributes.h"
33
34
  #include "absl/base/internal/bits.h"
34
35
  #include "absl/base/internal/raw_logging.h"
35
36
  #include "absl/strings/ascii.h"
@@ -719,8 +720,8 @@ inline bool safe_parse_sign_and_base(absl::string_view* text /*inout*/,
719
720
  // commonly used bases.
720
721
  template <typename IntType>
721
722
  struct LookupTables {
722
- static const IntType kVmaxOverBase[];
723
- static const IntType kVminOverBase[];
723
+ ABSL_CONST_INIT static const IntType kVmaxOverBase[];
724
+ ABSL_CONST_INIT static const IntType kVminOverBase[];
724
725
  };
725
726
 
726
727
  // An array initializer macro for X/base where base in [0, 36].
@@ -735,6 +736,49 @@ struct LookupTables {
735
736
  X / 35, X / 36, \
736
737
  }
737
738
 
739
+ // uint128& operator/=(uint128) is not constexpr, so hardcode the resulting
740
+ // array to avoid a static initializer.
741
+ template <>
742
+ const uint128 LookupTables<uint128>::kVmaxOverBase[] = {
743
+ 0,
744
+ 0,
745
+ MakeUint128(9223372036854775807u, 18446744073709551615u),
746
+ MakeUint128(6148914691236517205u, 6148914691236517205u),
747
+ MakeUint128(4611686018427387903u, 18446744073709551615u),
748
+ MakeUint128(3689348814741910323u, 3689348814741910323u),
749
+ MakeUint128(3074457345618258602u, 12297829382473034410u),
750
+ MakeUint128(2635249153387078802u, 5270498306774157604u),
751
+ MakeUint128(2305843009213693951u, 18446744073709551615u),
752
+ MakeUint128(2049638230412172401u, 14347467612885206812u),
753
+ MakeUint128(1844674407370955161u, 11068046444225730969u),
754
+ MakeUint128(1676976733973595601u, 8384883669867978007u),
755
+ MakeUint128(1537228672809129301u, 6148914691236517205u),
756
+ MakeUint128(1418980313362273201u, 4256940940086819603u),
757
+ MakeUint128(1317624576693539401u, 2635249153387078802u),
758
+ MakeUint128(1229782938247303441u, 1229782938247303441u),
759
+ MakeUint128(1152921504606846975u, 18446744073709551615u),
760
+ MakeUint128(1085102592571150095u, 1085102592571150095u),
761
+ MakeUint128(1024819115206086200u, 16397105843297379214u),
762
+ MakeUint128(970881267037344821u, 16504981539634861972u),
763
+ MakeUint128(922337203685477580u, 14757395258967641292u),
764
+ MakeUint128(878416384462359600u, 14054662151397753612u),
765
+ MakeUint128(838488366986797800u, 13415813871788764811u),
766
+ MakeUint128(802032351030850070u, 4812194106185100421u),
767
+ MakeUint128(768614336404564650u, 12297829382473034410u),
768
+ MakeUint128(737869762948382064u, 11805916207174113034u),
769
+ MakeUint128(709490156681136600u, 11351842506898185609u),
770
+ MakeUint128(683212743470724133u, 17080318586768103348u),
771
+ MakeUint128(658812288346769700u, 10540996613548315209u),
772
+ MakeUint128(636094623231363848u, 15266270957552732371u),
773
+ MakeUint128(614891469123651720u, 9838263505978427528u),
774
+ MakeUint128(595056260442243600u, 9520900167075897608u),
775
+ MakeUint128(576460752303423487u, 18446744073709551615u),
776
+ MakeUint128(558992244657865200u, 8943875914525843207u),
777
+ MakeUint128(542551296285575047u, 9765923333140350855u),
778
+ MakeUint128(527049830677415760u, 8432797290838652167u),
779
+ MakeUint128(512409557603043100u, 8198552921648689607u),
780
+ };
781
+
738
782
  template <typename IntType>
739
783
  const IntType LookupTables<IntType>::kVmaxOverBase[] =
740
784
  X_OVER_BASE_INITIALIZER(std::numeric_limits<IntType>::max());
@@ -754,6 +798,8 @@ inline bool safe_parse_positive_int(absl::string_view text, int base,
754
798
  assert(base >= 0);
755
799
  assert(vmax >= static_cast<IntType>(base));
756
800
  const IntType vmax_over_base = LookupTables<IntType>::kVmaxOverBase[base];
801
+ assert(base < 2 ||
802
+ std::numeric_limits<IntType>::max() / base == vmax_over_base);
757
803
  const char* start = text.data();
758
804
  const char* end = start + text.size();
759
805
  // loop over digits
@@ -787,6 +833,8 @@ inline bool safe_parse_negative_int(absl::string_view text, int base,
787
833
  assert(vmin < 0);
788
834
  assert(vmin <= 0 - base);
789
835
  IntType vmin_over_base = LookupTables<IntType>::kVminOverBase[base];
836
+ assert(base < 2 ||
837
+ std::numeric_limits<IntType>::min() / base == vmin_over_base);
790
838
  // 2003 c++ standard [expr.mul]
791
839
  // "... the sign of the remainder is implementation-defined."
792
840
  // Although (vmin/base)*base + vmin%base is always vmin.
@@ -852,9 +900,10 @@ inline bool safe_uint_internal(absl::string_view text, IntType* value_p,
852
900
  namespace numbers_internal {
853
901
 
854
902
  // Digit conversion.
855
- ABSL_CONST_INIT const char kHexChar[] = "0123456789abcdef";
903
+ ABSL_CONST_INIT ABSL_DLL const char kHexChar[] =
904
+ "0123456789abcdef";
856
905
 
857
- ABSL_CONST_INIT const char kHexTable[513] =
906
+ ABSL_CONST_INIT ABSL_DLL const char kHexTable[513] =
858
907
  "000102030405060708090a0b0c0d0e0f"
859
908
  "101112131415161718191a1b1c1d1e1f"
860
909
  "202122232425262728292a2b2c2d2e2f"
@@ -872,7 +921,7 @@ ABSL_CONST_INIT const char kHexTable[513] =
872
921
  "e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
873
922
  "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
874
923
 
875
- ABSL_CONST_INIT const char two_ASCII_digits[100][2] = {
924
+ ABSL_CONST_INIT ABSL_DLL const char two_ASCII_digits[100][2] = {
876
925
  {'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'},
877
926
  {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'},
878
927
  {'1', '2'}, {'1', '3'}, {'1', '4'}, {'1', '5'}, {'1', '6'}, {'1', '7'},
@@ -36,6 +36,7 @@
36
36
  #include <string>
37
37
  #include <type_traits>
38
38
 
39
+ #include "absl/base/config.h"
39
40
  #include "absl/base/internal/bits.h"
40
41
  #ifdef __SSE4_2__
41
42
  // TODO(jorg): Remove this when we figure out the right way
@@ -106,9 +107,11 @@ ABSL_NAMESPACE_BEGIN
106
107
  namespace numbers_internal {
107
108
 
108
109
  // Digit conversion.
109
- extern const char kHexChar[17]; // 0123456789abcdef
110
- extern const char kHexTable[513]; // 000102030405060708090a0b0c0d0e0f1011...
111
- extern const char two_ASCII_digits[100][2]; // 00, 01, 02, 03...
110
+ ABSL_DLL extern const char kHexChar[17]; // 0123456789abcdef
111
+ ABSL_DLL extern const char
112
+ kHexTable[513]; // 000102030405060708090a0b0c0d0e0f1011...
113
+ ABSL_DLL extern const char
114
+ two_ASCII_digits[100][2]; // 00, 01, 02, 03...
112
115
 
113
116
  // Writes a two-character representation of 'i' to 'buf'. 'i' must be in the
114
117
  // range 0 <= i < 100, and buf must have space for two characters. Example:
@@ -28,7 +28,19 @@
28
28
  #define ABSL_STRINGS_STRING_VIEW_H_
29
29
 
30
30
  #include <algorithm>
31
+ #include <cassert>
32
+ #include <cstddef>
33
+ #include <cstring>
34
+ #include <iosfwd>
35
+ #include <iterator>
36
+ #include <limits>
37
+ #include <string>
38
+
31
39
  #include "absl/base/config.h"
40
+ #include "absl/base/internal/throw_delegate.h"
41
+ #include "absl/base/macros.h"
42
+ #include "absl/base/optimization.h"
43
+ #include "absl/base/port.h"
32
44
 
33
45
  #ifdef ABSL_USES_STD_STRING_VIEW
34
46
 
@@ -49,19 +61,6 @@ ABSL_NAMESPACE_END
49
61
  #define ABSL_INTERNAL_STRING_VIEW_MEMCMP memcmp
50
62
  #endif // ABSL_HAVE_BUILTIN(__builtin_memcmp)
51
63
 
52
- #include <cassert>
53
- #include <cstddef>
54
- #include <cstring>
55
- #include <iosfwd>
56
- #include <iterator>
57
- #include <limits>
58
- #include <string>
59
-
60
- #include "absl/base/internal/throw_delegate.h"
61
- #include "absl/base/macros.h"
62
- #include "absl/base/optimization.h"
63
- #include "absl/base/port.h"
64
-
65
64
  namespace absl {
66
65
  ABSL_NAMESPACE_BEGIN
67
66
 
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.27.0.pre1
4
+ version: 1.27.0
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: 2020-01-23 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -292,8 +292,6 @@ files:
292
292
  - src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h
293
293
  - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
294
294
  - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h
295
- - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc
296
- - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h
297
295
  - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
298
296
  - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
299
297
  - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
@@ -1833,50 +1831,50 @@ required_ruby_version: !ruby/object:Gem::Requirement
1833
1831
  version: 2.3.0
1834
1832
  required_rubygems_version: !ruby/object:Gem::Requirement
1835
1833
  requirements:
1836
- - - ">"
1834
+ - - ">="
1837
1835
  - !ruby/object:Gem::Version
1838
- version: 1.3.1
1836
+ version: '0'
1839
1837
  requirements: []
1840
1838
  rubygems_version: 3.1.2
1841
1839
  signing_key:
1842
1840
  specification_version: 4
1843
1841
  summary: GRPC system in Ruby
1844
1842
  test_files:
1845
- - src/ruby/spec/server_credentials_spec.rb
1846
- - src/ruby/spec/client_auth_spec.rb
1847
- - src/ruby/spec/channel_credentials_spec.rb
1848
- - src/ruby/spec/server_spec.rb
1849
- - src/ruby/spec/time_consts_spec.rb
1850
- - src/ruby/spec/pb/duplicate/codegen_spec.rb
1851
- - src/ruby/spec/pb/health/checker_spec.rb
1843
+ - src/ruby/spec/client_server_spec.rb
1844
+ - src/ruby/spec/errors_spec.rb
1845
+ - src/ruby/spec/pb/codegen/package_option_spec.rb
1852
1846
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto
1853
1847
  - src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto
1854
1848
  - src/ruby/spec/pb/codegen/grpc/testing/package_options.proto
1855
- - src/ruby/spec/pb/codegen/package_option_spec.rb
1856
- - src/ruby/spec/testdata/client.pem
1857
- - src/ruby/spec/testdata/ca.pem
1858
- - src/ruby/spec/testdata/server1.key
1859
- - src/ruby/spec/testdata/server1.pem
1860
- - src/ruby/spec/testdata/README
1861
- - src/ruby/spec/testdata/client.key
1862
- - src/ruby/spec/channel_spec.rb
1863
- - src/ruby/spec/errors_spec.rb
1864
- - src/ruby/spec/spec_helper.rb
1865
- - src/ruby/spec/google_rpc_status_utils_spec.rb
1866
- - src/ruby/spec/call_credentials_spec.rb
1867
- - src/ruby/spec/client_server_spec.rb
1849
+ - src/ruby/spec/pb/health/checker_spec.rb
1850
+ - src/ruby/spec/pb/duplicate/codegen_spec.rb
1868
1851
  - src/ruby/spec/call_spec.rb
1869
- - src/ruby/spec/support/services.rb
1852
+ - src/ruby/spec/compression_options_spec.rb
1853
+ - src/ruby/spec/channel_spec.rb
1854
+ - src/ruby/spec/channel_credentials_spec.rb
1870
1855
  - src/ruby/spec/support/helpers.rb
1871
- - src/ruby/spec/generic/rpc_server_pool_spec.rb
1872
- - src/ruby/spec/generic/client_interceptors_spec.rb
1873
- - src/ruby/spec/generic/client_stub_spec.rb
1856
+ - src/ruby/spec/support/services.rb
1857
+ - src/ruby/spec/spec_helper.rb
1874
1858
  - src/ruby/spec/generic/rpc_server_spec.rb
1875
1859
  - src/ruby/spec/generic/service_spec.rb
1876
- - src/ruby/spec/generic/interceptor_registry_spec.rb
1860
+ - src/ruby/spec/generic/client_stub_spec.rb
1877
1861
  - src/ruby/spec/generic/server_interceptors_spec.rb
1878
- - src/ruby/spec/generic/rpc_desc_spec.rb
1879
1862
  - src/ruby/spec/generic/active_call_spec.rb
1880
- - src/ruby/spec/channel_connection_spec.rb
1881
- - src/ruby/spec/compression_options_spec.rb
1863
+ - src/ruby/spec/generic/rpc_desc_spec.rb
1864
+ - src/ruby/spec/generic/rpc_server_pool_spec.rb
1865
+ - src/ruby/spec/generic/client_interceptors_spec.rb
1866
+ - src/ruby/spec/generic/interceptor_registry_spec.rb
1867
+ - src/ruby/spec/call_credentials_spec.rb
1882
1868
  - src/ruby/spec/error_sanity_spec.rb
1869
+ - src/ruby/spec/channel_connection_spec.rb
1870
+ - src/ruby/spec/client_auth_spec.rb
1871
+ - src/ruby/spec/time_consts_spec.rb
1872
+ - src/ruby/spec/testdata/ca.pem
1873
+ - src/ruby/spec/testdata/server1.pem
1874
+ - src/ruby/spec/testdata/client.pem
1875
+ - src/ruby/spec/testdata/README
1876
+ - src/ruby/spec/testdata/server1.key
1877
+ - src/ruby/spec/testdata/client.key
1878
+ - src/ruby/spec/server_spec.rb
1879
+ - src/ruby/spec/server_credentials_spec.rb
1880
+ - src/ruby/spec/google_rpc_status_utils_spec.rb
@@ -1,89 +0,0 @@
1
- //
2
- // Copyright 2019 gRPC authors.
3
- //
4
- // Licensed under the Apache License, Version 2.0 (the "License");
5
- // you may not use this file except in compliance with the License.
6
- // You may obtain a copy of the License at
7
- //
8
- // http://www.apache.org/licenses/LICENSE-2.0
9
- //
10
- // Unless required by applicable law or agreed to in writing, software
11
- // distributed under the License is distributed on an "AS IS" BASIS,
12
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- // See the License for the specific language governing permissions and
14
- // limitations under the License.
15
- //
16
-
17
- #include <grpc/support/port_platform.h>
18
-
19
- #include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h"
20
-
21
- #include "src/core/lib/channel/channel_args.h"
22
- #include "src/core/lib/gpr/useful.h"
23
-
24
- // Channel arg key for the list of balancer addresses.
25
- #define GRPC_ARG_GRPCLB_BALANCER_ADDRESSES "grpc.grpclb_balancer_addresses"
26
- // Channel arg key for a string indicating an address's balancer name.
27
- #define GRPC_ARG_ADDRESS_BALANCER_NAME "grpc.address_balancer_name"
28
-
29
- namespace grpc_core {
30
-
31
- namespace {
32
-
33
- void* BalancerAddressesArgCopy(void* p) {
34
- ServerAddressList* address_list = static_cast<ServerAddressList*>(p);
35
- return new ServerAddressList(*address_list);
36
- }
37
-
38
- void BalancerAddressesArgDestroy(void* p) {
39
- ServerAddressList* address_list = static_cast<ServerAddressList*>(p);
40
- delete address_list;
41
- }
42
-
43
- int BalancerAddressesArgCmp(void* p, void* q) {
44
- ServerAddressList* address_list1 = static_cast<ServerAddressList*>(p);
45
- ServerAddressList* address_list2 = static_cast<ServerAddressList*>(q);
46
- if (address_list1 == nullptr || address_list2 == nullptr) {
47
- return GPR_ICMP(address_list1, address_list2);
48
- }
49
- if (address_list1->size() > address_list2->size()) return 1;
50
- if (address_list1->size() < address_list2->size()) return -1;
51
- for (size_t i = 0; i < address_list1->size(); ++i) {
52
- int retval = (*address_list1)[i].Cmp((*address_list2)[i]);
53
- if (retval != 0) return retval;
54
- }
55
- return 0;
56
- }
57
-
58
- const grpc_arg_pointer_vtable kBalancerAddressesArgVtable = {
59
- BalancerAddressesArgCopy, BalancerAddressesArgDestroy,
60
- BalancerAddressesArgCmp};
61
-
62
- } // namespace
63
-
64
- grpc_arg CreateGrpclbBalancerAddressesArg(
65
- const ServerAddressList* address_list) {
66
- return grpc_channel_arg_pointer_create(
67
- const_cast<char*>(GRPC_ARG_GRPCLB_BALANCER_ADDRESSES),
68
- const_cast<ServerAddressList*>(address_list),
69
- &kBalancerAddressesArgVtable);
70
- }
71
-
72
- const ServerAddressList* FindGrpclbBalancerAddressesInChannelArgs(
73
- const grpc_channel_args& args) {
74
- return grpc_channel_args_find_pointer<const ServerAddressList>(
75
- &args, const_cast<char*>(GRPC_ARG_GRPCLB_BALANCER_ADDRESSES));
76
- }
77
-
78
- grpc_arg CreateGrpclbBalancerNameArg(const char* balancer_name) {
79
- return grpc_channel_arg_string_create(
80
- const_cast<char*>(GRPC_ARG_ADDRESS_BALANCER_NAME),
81
- const_cast<char*>(balancer_name));
82
- }
83
-
84
- const char* FindGrpclbBalancerNameInChannelArgs(const grpc_channel_args& args) {
85
- return grpc_channel_args_find_string(
86
- &args, const_cast<char*>(GRPC_ARG_ADDRESS_BALANCER_NAME));
87
- }
88
-
89
- } // namespace grpc_core
@@ -1,40 +0,0 @@
1
- //
2
- // Copyright 2019 gRPC authors.
3
- //
4
- // Licensed under the Apache License, Version 2.0 (the "License");
5
- // you may not use this file except in compliance with the License.
6
- // You may obtain a copy of the License at
7
- //
8
- // http://www.apache.org/licenses/LICENSE-2.0
9
- //
10
- // Unless required by applicable law or agreed to in writing, software
11
- // distributed under the License is distributed on an "AS IS" BASIS,
12
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- // See the License for the specific language governing permissions and
14
- // limitations under the License.
15
- //
16
-
17
- #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H
18
- #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H
19
-
20
- #include <grpc/support/port_platform.h>
21
-
22
- #include <grpc/impl/codegen/grpc_types.h>
23
-
24
- #include "src/core/ext/filters/client_channel/server_address.h"
25
-
26
- namespace grpc_core {
27
-
28
- grpc_arg CreateGrpclbBalancerAddressesArg(
29
- const ServerAddressList* address_list);
30
- const ServerAddressList* FindGrpclbBalancerAddressesInChannelArgs(
31
- const grpc_channel_args& args);
32
-
33
- grpc_arg CreateGrpclbBalancerNameArg(const char* balancer_name);
34
- const char* FindGrpclbBalancerNameInChannelArgs(const grpc_channel_args& args);
35
-
36
- } // namespace grpc_core
37
-
38
- #endif /* \
39
- GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H \
40
- */