Skip to content

Commit

Permalink
debug output remove later
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Beyad <abeyad@google.com>
  • Loading branch information
abeyad committed Oct 19, 2023
1 parent 0539930 commit 20f1d09
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/common/upstream/cluster_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,7 @@ ClusterManagerImpl::ThreadLocalClusterManagerImpl::ClusterEntry::httpConnPoolImp
LoadBalancerContext* context, bool peek) {
std::cerr << "==> AAB httpConnPoolImpl" << std::endl; // TODO: rm
HostConstSharedPtr host = (peek ? peekAnotherHost(context) : chooseHost(context));
std::cerr << "==> AAB httpConnPoolImpl 1" << std::endl; // TODO: rm
if (!host) {
if (!peek) {
ENVOY_LOG(debug, "no healthy host for HTTP connection pool");
Expand All @@ -1990,12 +1991,14 @@ ClusterManagerImpl::ThreadLocalClusterManagerImpl::ClusterEntry::httpConnPoolImp
std::cerr << "==> AAB httpConnPoolImpl no host, return nullptr" << std::endl; // TODO: rm
return nullptr;
}
std::cerr << "==> AAB httpConnPoolImpl 2" << std::endl; // TODO: rm

// Right now, HTTP, HTTP/2 and ALPN pools are considered separate.
// We could do better here, and always use the ALPN pool and simply make sure
// we end up on a connection of the correct protocol, but for simplicity we're
// starting with something simpler.
auto upstream_protocols = host->cluster().upstreamHttpProtocol(downstream_protocol);
std::cerr << "==> AAB httpConnPoolImpl 3" << std::endl; // TODO: rm
std::vector<uint8_t> hash_key;
hash_key.reserve(upstream_protocols.size());
for (auto protocol : upstream_protocols) {
Expand All @@ -2004,41 +2007,48 @@ ClusterManagerImpl::ThreadLocalClusterManagerImpl::ClusterEntry::httpConnPoolImp

absl::optional<envoy::config::core::v3::AlternateProtocolsCacheOptions>
alternate_protocol_options = host->cluster().alternateProtocolsCacheOptions();
std::cerr << "==> AAB httpConnPoolImpl 4" << std::endl; // TODO: rm
Network::Socket::OptionsSharedPtr upstream_options(std::make_shared<Network::Socket::Options>());
std::cerr << "==> AAB httpConnPoolImpl 5" << std::endl; // TODO: rm
if (context) {
// Inherit socket options from downstream connection, if set.
if (context->downstreamConnection()) {
addOptionsIfNotNull(upstream_options, context->downstreamConnection()->socketOptions());
}
addOptionsIfNotNull(upstream_options, context->upstreamSocketOptions());
}
std::cerr << "==> AAB httpConnPoolImpl 6" << std::endl; // TODO: rm

// Use the socket options for computing connection pool hash key, if any.
// This allows socket options to control connection pooling so that connections with
// different options are not pooled together.
for (const auto& option : *upstream_options) {
option->hashKey(hash_key);
}
std::cerr << "==> AAB httpConnPoolImpl 7" << std::endl; // TODO: rm

bool have_transport_socket_options = false;
if (context && context->upstreamTransportSocketOptions()) {
host->transportSocketFactory().hashKey(hash_key, context->upstreamTransportSocketOptions());
have_transport_socket_options = true;
}
std::cerr << "==> AAB httpConnPoolImpl 8" << std::endl; // TODO: rm

// If configured, use the downstream connection id in pool hash key
if (cluster_info_->connectionPoolPerDownstreamConnection() && context &&
context->downstreamConnection()) {
context->downstreamConnection()->hashKey(hash_key);
}
std::cerr << "==> AAB httpConnPoolImpl 9" << std::endl; // TODO: rm

ConnPoolsContainer& container = *parent_.getHttpConnPoolsContainer(host, true);
std::cerr << "==> AAB httpConnPoolImpl 10" << std::endl; // TODO: rm

// Note: to simplify this, we assume that the factory is only called in the scope of this
// function. Otherwise, we'd need to capture a few of these variables by value.
ConnPoolsContainer::ConnPools::PoolOptRef pool =
container.pools_->getPool(priority, hash_key, [&]() {
std::cerr << "==> AAB calling allocateConnPool" << std::endl;
std::cerr << "==> AAB httpConnPoolImpl calling allocateConnPool **** " << std::endl;
auto pool = parent_.parent_.factory_.allocateConnPool(
parent_.thread_local_dispatcher_, host, priority, upstream_protocols,
alternate_protocol_options, !upstream_options->empty() ? upstream_options : nullptr,
Expand Down

0 comments on commit 20f1d09

Please sign in to comment.