Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk committed Jan 20, 2021
1 parent 9edcf34 commit a7caf30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions source/common/conn_pool/conn_pool_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ConnPoolImplBase::ConnectionResult ConnPoolImplBase::tryCreateNewConnections() {
// overwhelming it with connections is not desirable.
for (int i = 0; i < 3; ++i) {
result = tryCreateNewConnection();
if (result != ConnectionResult::CREATED_NEW_CONNECTION) {
if (result != ConnectionResult::CreatedNewConnection) {
break;
}
}
Expand All @@ -116,7 +116,7 @@ ConnPoolImplBase::ConnectionResult
ConnPoolImplBase::tryCreateNewConnection(float global_preconnect_ratio) {
// There are already enough CONNECTING connections for the number of queued streams.
if (!shouldCreateNewConnection(global_preconnect_ratio)) {
return ConnectionResult::SHOULD_NOT_CONNECT;
return ConnectionResult::ShouldNotConnect;
}

const bool can_create_connection =
Expand All @@ -139,11 +139,11 @@ ConnPoolImplBase::tryCreateNewConnection(float global_preconnect_ratio) {
state_.incrConnectingStreamCapacity(client->effectiveConcurrentStreamLimit());
connecting_stream_capacity_ += client->effectiveConcurrentStreamLimit();
LinkedList::moveIntoList(std::move(client), owningList(client->state_));
return can_create_connection ? ConnectionResult::CREATED_NEW_CONNECTION
: ConnectionResult::CREATED_BUT_RATE_LIMITED;
return can_create_connection ? ConnectionResult::CreatedNewConnection
: ConnectionResult::CreatedButRateLimited;
} else {
ENVOY_LOG(trace, "not creating a new connection: connection constrained");
return ConnectionResult::NO_CREATION_RATE_LIMITED;
return ConnectionResult::NoConnectionRateLimited;
}
}

Expand Down Expand Up @@ -236,7 +236,7 @@ ConnectionPool::Cancellable* ConnPoolImplBase::newStream(AttachContext& context)
// increase capacity is if the connection limits are exceeded.
ENVOY_BUG(pending_streams_.size() <= connecting_stream_capacity_ ||
connecting_stream_capacity_ > old_capacity ||
result == ConnectionResult::NO_CREATION_RATE_LIMITED,
result == ConnectionResult::NoConnectionRateLimited,
fmt::format("Failed to create expected connection: {}", *this));
return pending;
} else {
Expand All @@ -250,7 +250,7 @@ ConnectionPool::Cancellable* ConnPoolImplBase::newStream(AttachContext& context)

bool ConnPoolImplBase::maybePreconnect(float global_preconnect_ratio) {
return tryCreateNewConnection(global_preconnect_ratio) ==
ConnectionResult::CREATED_NEW_CONNECTION;
ConnectionResult::CreatedNewConnection;
}

void ConnPoolImplBase::scheduleOnUpstreamReady() {
Expand Down
8 changes: 4 additions & 4 deletions source/common/conn_pool/conn_pool_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ class ConnPoolImplBase : protected Logger::Loggable<Logger::Id::pool> {
virtual void onConnected(Envoy::ConnectionPool::ActiveClient&) {}

enum class ConnectionResult {
CREATED_NEW_CONNECTION,
SHOULD_NOT_CONNECT,
NO_CREATION_RATE_LIMITED,
CREATED_BUT_RATE_LIMITED,
CreatedNewConnection,
ShouldNotConnect,
NoConnectionRateLimited,
CreatedButRateLimited,
};

// Creates up to 3 connections, based on the preconnect ratio.
Expand Down

0 comments on commit a7caf30

Please sign in to comment.