Skip to content

Commit

Permalink
Merge branch 'shush-connect' into shush-chaotic-protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Jan 23, 2024
2 parents 11d6b20 + 9f3e590 commit 24cf89e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 54 deletions.
33 changes: 18 additions & 15 deletions src/core/ext/filters/client_channel/lb_policy/xds/cds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,23 @@ absl::Status CdsLb::UpdateLocked(UpdateArgs args) {
} else {
GPR_ASSERT(cluster_name_ == new_config->cluster());
}
// Start dynamic subscription if needed.
if (new_config->is_dynamic() && subscription_ == nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
gpr_log(GPR_INFO,
"[cdslb %p] obtaining dynamic subscription for cluster %s", this,
cluster_name_.c_str());
}
auto* dependency_mgr = args.args.GetObject<XdsDependencyManager>();
if (dependency_mgr == nullptr) {
// Should never happen.
absl::Status status =
absl::InternalError("xDS dependency mgr not passed to CDS LB policy");
ReportTransientFailure(status);
return status;
}
subscription_ = dependency_mgr->GetClusterSubscription(cluster_name_);
}
// Get xDS config.
auto new_xds_config = args.args.GetObjectRef<XdsConfig>();
if (new_xds_config == nullptr) {
Expand All @@ -307,27 +324,13 @@ absl::Status CdsLb::UpdateLocked(UpdateArgs args) {
if (it == new_xds_config->clusters.end()) {
// Cluster not present.
if (new_config->is_dynamic()) {
// This is a dynamic cluster. Subscribe to it if not yet subscribed.
if (subscription_ == nullptr) {
auto* dependency_mgr = args.args.GetObject<XdsDependencyManager>();
if (dependency_mgr == nullptr) {
// Should never happen.
absl::Status status = absl::InternalError(
"xDS dependency mgr not passed to CDS LB policy");
ReportTransientFailure(status);
return status;
}
subscription_ = dependency_mgr->GetClusterSubscription(cluster_name_);
// Stay in CONNECTING until we get an update that has the cluster.
return absl::OkStatus();
}
// If we are already subscribed, it's possible that we just
// recently subscribed but another update came through before we
// got the new cluster, in which case it will still be missing.
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
gpr_log(GPR_INFO,
"[cdslb %p] xDS config has no entry for dynamic cluster %s, "
"ignoring update",
"waiting for subsequent update",
this, cluster_name_.c_str());
}
// Stay in CONNECTING until we get an update that has the cluster.
Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/gpr/posix/sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,5 @@ void gpr_once_init(gpr_once* once, void (*init_function)(void)) {
GPR_ASSERT(pthread_once(once, init_function) == 0);
}

#endif // defined(GPR_POSIX_SYNC) && !defined(GPR_ABSEIL_SYNC) && \
// !defined(GPR_CUSTOM_SYNC)
#endif // defined(GPR_POSIX_SYNC) && !defined(GPR_ABSEIL_SYNC) &&
// !defined(GPR_CUSTOM_SYNC)
4 changes: 2 additions & 2 deletions src/core/lib/gpr/windows/sync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,5 @@ void gpr_once_init(gpr_once* once, void (*init_function)(void)) {
InitOnceExecuteOnce(once, run_once_func, &arg, &phony);
}

#endif // defined(GPR_WINDOWS) && !defined(GPR_ABSEIL_SYNC) && \
// !defined(GPR_CUSTOM_SYNC)
#endif // defined(GPR_WINDOWS) && !defined(GPR_ABSEIL_SYNC) &&
// !defined(GPR_CUSTOM_SYNC)
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/grpc_if_nametoindex_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ uint32_t grpc_if_nametoindex(char* name) {
return out;
}

#endif // GRPC_IF_NAMETOINDEX == 1 && \
// defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
#endif // GRPC_IF_NAMETOINDEX == 1 &&
// defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
4 changes: 2 additions & 2 deletions src/core/lib/iomgr/grpc_if_nametoindex_unsupported.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ uint32_t grpc_if_nametoindex(char* name) {
return 0;
}

#endif // GRPC_IF_NAMETOINDEX == 0 || \
// !defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
#endif // GRPC_IF_NAMETOINDEX == 0 ||
// !defined(GRPC_POSIX_SOCKET_IF_NAMETOINDEX)
8 changes: 0 additions & 8 deletions src/core/lib/security/transport/security_handshaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,3 @@ void SecurityRegisterHandshakerFactories(CoreConfiguration::Builder* builder) {
}

} // namespace grpc_core

grpc_handshaker* grpc_security_handshaker_create(
tsi_handshaker* handshaker, grpc_security_connector* connector,
const grpc_channel_args* args) {
return SecurityHandshakerCreate(handshaker, connector,
grpc_core::ChannelArgs::FromC(args))
.release();
}
6 changes: 0 additions & 6 deletions src/core/lib/security/transport/security_handshaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,4 @@ void SecurityRegisterHandshakerFactories(CoreConfiguration::Builder*);

} // namespace grpc_core

// TODO(arjunroy): This is transitional to account for the new handshaker API
// and will eventually be removed entirely.
grpc_handshaker* grpc_security_handshaker_create(
tsi_handshaker* handshaker, grpc_security_connector* connector,
const grpc_channel_args* args);

#endif // GRPC_SRC_CORE_LIB_SECURITY_TRANSPORT_SECURITY_HANDSHAKER_H
8 changes: 0 additions & 8 deletions src/core/lib/transport/handshaker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,3 @@ void HandshakeManager::DoHandshake(grpc_endpoint* endpoint,
}

} // namespace grpc_core

void grpc_handshake_manager_add(grpc_handshake_manager* mgr,
grpc_handshaker* handshaker) {
// This is a transition method to aid the API change for handshakers.
grpc_core::RefCountedPtr<grpc_core::Handshaker> refd_hs(
static_cast<grpc_core::Handshaker*>(handshaker));
mgr->Add(refd_hs);
}
7 changes: 0 additions & 7 deletions src/core/lib/transport/handshaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,4 @@ class HandshakeManager : public RefCounted<HandshakeManager> {

} // namespace grpc_core

// TODO(arjunroy): These are transitional to account for the new handshaker API
// and will eventually be removed entirely.
typedef grpc_core::HandshakeManager grpc_handshake_manager;
typedef grpc_core::Handshaker grpc_handshaker;
void grpc_handshake_manager_add(grpc_handshake_manager* mgr,
grpc_handshaker* handshaker);

#endif // GRPC_SRC_CORE_LIB_TRANSPORT_HANDSHAKER_H
4 changes: 2 additions & 2 deletions test/core/security/credentials_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1944,8 +1944,8 @@ TEST(CredentialsTest, TestGetWellKnownGoogleCredentialsFilePath) {
// so we set it to some fake value
restore_home_env = true;
SetEnv("HOME", "/fake/home/for/bazel");
#endif // defined(GRPC_BAZEL_BUILD) && (defined(GPR_POSIX_ENV) || \
// defined(GPR_LINUX_ENV))
#endif // defined(GRPC_BAZEL_BUILD) && (defined(GPR_POSIX_ENV) ||
// defined(GPR_LINUX_ENV))
std::string path = grpc_get_well_known_google_credentials_file_path();
GPR_ASSERT(!path.empty());
#if defined(GPR_POSIX_ENV) || defined(GPR_LINUX_ENV)
Expand Down

0 comments on commit 24cf89e

Please sign in to comment.