You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
576 B
C++
31 lines
576 B
C++
![]()
6 years ago
|
#include "webcc/connection_pool.h"
|
||
![]()
6 years ago
|
|
||
|
#include "webcc/logger.h"
|
||
|
|
||
|
namespace webcc {
|
||
|
|
||
![]()
6 years ago
|
ConnectionPool::ConnectionPool() {
|
||
![]()
6 years ago
|
}
|
||
|
|
||
![]()
6 years ago
|
void ConnectionPool::Start(ConnectionPtr c) {
|
||
![]()
6 years ago
|
LOG_VERB("Starting connection...");
|
||
|
connections_.insert(c);
|
||
|
c->Start();
|
||
|
}
|
||
|
|
||
![]()
6 years ago
|
void ConnectionPool::Close(ConnectionPtr c) {
|
||
![]()
6 years ago
|
LOG_VERB("Closing connection...");
|
||
|
connections_.erase(c);
|
||
|
c->Close();
|
||
|
}
|
||
|
|
||
![]()
6 years ago
|
void ConnectionPool::CloseAll() {
|
||
![]()
6 years ago
|
LOG_VERB("Closing all (%u) connections...", connections_.size());
|
||
|
for (auto& c : connections_) {
|
||
|
c->Close();
|
||
|
}
|
||
|
connections_.clear();
|
||
|
}
|
||
|
|
||
|
} // namespace webcc
|