Skip to content

Commit

Permalink
conn_pool: fixing comments (#13520)
Browse files Browse the repository at this point in the history
Risk Level: n/a (comment + rename)
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Fixes #13369

Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk authored Oct 13, 2020
1 parent 21c827c commit cb7691c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/envoy/common/conn_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Instance {
using DrainedCb = std::function<void()>;

/**
* Register a callback that gets called when the connection pool is fully drained. No actual
* draining is done. The owner of the connection pool is responsible for not creating any
* Register a callback that gets called when the connection pool is fully drained and kicks
* off a drain. The owner of the connection pool is responsible for not creating any
* new streams.
*/
virtual void addDrainedCallback(DrainedCb cb) PURE;
Expand Down
6 changes: 3 additions & 3 deletions source/common/conn_pool/conn_pool_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void ConnPoolImplBase::addDrainedCallbackImpl(Instance::DrainedCb cb) {
checkForDrained();
}

void ConnPoolImplBase::closeIdleConnections() {
void ConnPoolImplBase::closeIdleConnectionsForDrainingPool() {
// Create a separate list of elements to close to avoid mutate-while-iterating problems.
std::list<ActiveClient*> to_close;

Expand All @@ -268,7 +268,7 @@ void ConnPoolImplBase::closeIdleConnections() {
}

void ConnPoolImplBase::drainConnectionsImpl() {
closeIdleConnections();
closeIdleConnectionsForDrainingPool();

// closeIdleConnections() closes all connections in ready_clients_ with no active streams,
// so all remaining entries in ready_clients_ are serving streams. Move them and all entries
Expand All @@ -290,7 +290,7 @@ void ConnPoolImplBase::checkForDrained() {
return;
}

closeIdleConnections();
closeIdleConnectionsForDrainingPool();

if (pending_streams_.empty() && ready_clients_.empty() && busy_clients_.empty() &&
connecting_clients_.empty()) {
Expand Down
5 changes: 3 additions & 2 deletions source/common/conn_pool/conn_pool_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ class ConnPoolImplBase : protected Logger::Loggable<Logger::Id::pool> {
absl::string_view failure_reason,
ConnectionPool::PoolFailureReason pool_failure_reason);

// Closes any idle connections.
void closeIdleConnections();
// Closes any idle connections as this pool is drained.
void closeIdleConnectionsForDrainingPool();

// Changes the state_ of an ActiveClient and moves to the appropriate list.
void transitionActiveClientState(ActiveClient& client, ActiveClient::State new_state);

void onConnectionEvent(ActiveClient& client, absl::string_view failure_reason,
Network::ConnectionEvent event);
// See if the drain process has started and/or completed.
void checkForDrained();
void onUpstreamReady();
ConnectionPool::Cancellable* newStream(AttachContext& context);
Expand Down

0 comments on commit cb7691c

Please sign in to comment.