Refine the connection close

This commit is contained in:
Chunting Gu
2019-07-15 15:36:30 +08:00
parent 2a20030f7e
commit 46ea52cb90
24 changed files with 214 additions and 147 deletions
+6 -4
View File
@@ -17,11 +17,13 @@ void ConnectionPool::Close(ConnectionPtr c) {
}
void ConnectionPool::CloseAll() {
LOG_VERB("Closing all (%u) connections...", connections_.size());
for (auto& c : connections_) {
c->Close();
if (!connections_.empty()) {
LOG_VERB("Closing all (%u) connections...", connections_.size());
for (auto& c : connections_) {
c->Close();
}
connections_.clear();
}
connections_.clear();
}
} // namespace webcc