| 436 | } |
| 437 | |
| 438 | std::multimap<std::string, DownloadEngine::SocketPoolEntry>::iterator |
| 439 | DownloadEngine::findSocketPoolEntry(const std::string& key) |
| 440 | { |
| 441 | std::pair<std::multimap<std::string, SocketPoolEntry>::iterator, |
| 442 | std::multimap<std::string, SocketPoolEntry>::iterator> |
| 443 | range = socketPool_.equal_range(key); |
| 444 | for (auto i = range.first, eoi = range.second; i != eoi; ++i) { |
| 445 | const SocketPoolEntry& e = (*i).second; |
| 446 | // We assume that if socket is readable it means peer shutdowns |
| 447 | // connection and the socket will receive EOF. So skip it. |
| 448 | if (!e.isTimeout() && !e.getSocket()->isReadable(0)) { |
| 449 | A2_LOG_INFO(fmt("Found socket for %s", key.c_str())); |
| 450 | return i; |
| 451 | } |
| 452 | } |
| 453 | return socketPool_.end(); |
| 454 | } |
| 455 | |
| 456 | std::shared_ptr<SocketCore> |
| 457 | DownloadEngine::popPooledSocket(const std::string& ipaddr, uint16_t port, |
nothing calls this directly
no test coverage detected