rework client using async api
This commit is contained in:
@@ -6,7 +6,7 @@ namespace webcc {
|
||||
|
||||
ClientPool::~ClientPool() {
|
||||
if (!clients_.empty()) {
|
||||
LOG_INFO("Close socket for all (%u) connections in the pool.",
|
||||
LOG_INFO("Close socket for all (%u) connections in the pool",
|
||||
clients_.size());
|
||||
|
||||
for (auto& pair : clients_) {
|
||||
@@ -21,21 +21,21 @@ ClientPtr ClientPool::Get(const Key& key) const {
|
||||
if (it != clients_.end()) {
|
||||
return it->second;
|
||||
} else {
|
||||
return ClientPtr{};
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
void ClientPool::Add(const Key& key, ClientPtr client) {
|
||||
clients_[key] = client;
|
||||
|
||||
LOG_INFO("Added connection to pool (%s, %s, %s).",
|
||||
LOG_INFO("Connection added to pool (%s, %s, %s)",
|
||||
key.scheme.c_str(), key.host.c_str(), key.port.c_str());
|
||||
}
|
||||
|
||||
void ClientPool::Remove(const Key& key) {
|
||||
clients_.erase(key);
|
||||
|
||||
LOG_INFO("Removed connection from pool (%s, %s, %s).",
|
||||
LOG_INFO("Connection removed from pool (%s, %s, %s)",
|
||||
key.scheme.c_str(), key.host.c_str(), key.port.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user