| 184 | } |
| 185 | |
| 186 | void ClientCacheHelper::CloseConnections(const TNetworkAddress& address) { |
| 187 | PerHostCache* cache; |
| 188 | { |
| 189 | lock_guard<mutex> lock(cache_lock_); |
| 190 | PerHostCacheMap::iterator cache_it = per_host_caches_.find(address); |
| 191 | if (cache_it == per_host_caches_.end()) return; |
| 192 | cache = cache_it->second.get(); |
| 193 | } |
| 194 | |
| 195 | { |
| 196 | VLOG(2) << "Invalidating all " << cache->clients.size() << " clients for: " |
| 197 | << TNetworkAddressToString(address); |
| 198 | lock_guard<mutex> entry_lock(cache->lock); |
| 199 | lock_guard<mutex> map_lock(client_map_lock_); |
| 200 | for (ClientKey client_key: cache->clients) { |
| 201 | ClientMap::iterator client_map_entry = client_map_.find(client_key); |
| 202 | DCHECK(client_map_entry != client_map_.end()); |
| 203 | client_map_entry->second->Close(); |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | string ClientCacheHelper::DebugString() { |
| 209 | lock_guard<mutex> lock(cache_lock_); |