rework client using async api
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
namespace webcc {
|
||||
|
||||
void ConnectionPool::Start(ConnectionPtr c) {
|
||||
LOG_VERB("Starting connection...");
|
||||
LOG_VERB("Start connection");
|
||||
|
||||
{
|
||||
// Lock the container only.
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
std::lock_guard<std::mutex> lock{ mutex_ };
|
||||
connections_.insert(c);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ void ConnectionPool::Start(ConnectionPtr c) {
|
||||
}
|
||||
|
||||
void ConnectionPool::Close(ConnectionPtr c) {
|
||||
LOG_VERB("Closing connection...");
|
||||
LOG_VERB("Close connection");
|
||||
|
||||
{
|
||||
// Lock the container only.
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
std::lock_guard<std::mutex> lock{ mutex_ };
|
||||
connections_.erase(c);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ void ConnectionPool::Close(ConnectionPtr c) {
|
||||
|
||||
void ConnectionPool::Clear() {
|
||||
// Lock all since we are going to stop anyway.
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
std::lock_guard<std::mutex> lock{ mutex_ };
|
||||
|
||||
if (!connections_.empty()) {
|
||||
LOG_VERB("Closing all (%u) connections...", connections_.size());
|
||||
LOG_VERB("Close all (%u) connections", connections_.size());
|
||||
for (auto& c : connections_) {
|
||||
c->Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user