Skip to content

Commit

Permalink
net: cleanup pending listen ctx on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed Sep 17, 2024
1 parent 53417ca commit 95da774
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/net/content_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class ContentServer {
VLOG(1) << "ContentServer (" << T::Name << ") "
<< " freed memory";

CHECK_EQ(pending_next_listen_ctxes_.size(), 0u) << "ContentServer freed on pending listen ctx";
CHECK_EQ(opened_connections_, 0u) << "ContentServer freed on non-closed connections";
CHECK_EQ(connection_map_.size(), 0u) << "ContentServer freed on non-closed connections";

client_instance_ = nullptr;

work_guard_.reset();
Expand Down Expand Up @@ -170,6 +174,9 @@ class ContentServer {
}
}
}

pending_next_listen_ctxes_.clear();

if (connection_map_.empty()) {
LOG(WARNING) << "No more connections alive... ready to stop";
work_guard_.reset();
Expand All @@ -196,6 +203,8 @@ class ContentServer {
}
}

pending_next_listen_ctxes_.clear();

auto connection_map = std::move(connection_map_);
// FIXME silence some false-positive warning from abseil-cpp
connection_map_ = absl::flat_hash_map<int, scoped_refptr<ConnectionType>>();
Expand Down

0 comments on commit 95da774

Please sign in to comment.