Skip to content

Commit

Permalink
grid: fixing a teardown bug
Browse files Browse the repository at this point in the history
Signed-off-by: Alyssa Wilk <[email protected]>
  • Loading branch information
alyssawilk committed Feb 14, 2024
1 parent 32dd294 commit 37d4e51
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/common/http/conn_pool_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ void ConnectivityGrid::WrapperCallbacks::cancelAllPendingAttempts(

absl::optional<ConnectivityGrid::StreamCreationResult>
ConnectivityGrid::WrapperCallbacks::tryAnotherConnection() {
if (grid_.destroying_) {
return {};
}
absl::optional<PoolIterator> next_pool = grid_.nextPool(current_);
if (!next_pool.has_value()) {
// If there are no other pools to try, return an empty optional.
Expand Down Expand Up @@ -236,10 +239,10 @@ ConnectivityGrid::ConnectivityGrid(
ConnectivityGrid::~ConnectivityGrid() {
// Ignore idle callbacks while the pools are destroyed below.
destroying_ = true;
// Callbacks might have pending streams registered with the pools, so cancel and delete
// the callback before deleting the pools.
wrapped_callbacks_.clear();
// Make sure to clear the pools (which deletes all active connections, and
// signals callers) before deleting callbacks.
pools_.clear();
wrapped_callbacks_.clear();
}

void ConnectivityGrid::deleteIsPending() {
Expand Down

0 comments on commit 37d4e51

Please sign in to comment.