diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-09 18:16:08 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-09 18:17:04 +0900 |
| commit | ea4d99ea087d8f1bafa812017efa26cb90d99947 (patch) | |
| tree | f2a4b2e9cbbec1a2a98d5f452a230f116c47748a /src/DownloadEngine.cc | |
| parent | e899eba76f7b8f91805176db4460f91e0a4dd487 (diff) | |
Refactor SocketCore::getPeerInfo, getAddrInfo to return Endpoint object
Diffstat (limited to 'src/DownloadEngine.cc')
| -rw-r--r-- | src/DownloadEngine.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/DownloadEngine.cc b/src/DownloadEngine.cc index 9ea907ac..72e617c2 100644 --- a/src/DownloadEngine.cc +++ b/src/DownloadEngine.cc @@ -371,11 +371,10 @@ void DownloadEngine::poolSocket(const std::string& ipaddr, uint16_t port, } namespace { -bool getPeerInfo(std::pair<std::string, uint16_t>& res, - const std::shared_ptr<SocketCore>& socket) +bool getPeerInfo(Endpoint& res, const std::shared_ptr<SocketCore>& socket) { try { - socket->getPeerInfo(res); + res = socket->getPeerInfo(); return true; } catch (RecoverableException& e) { @@ -399,9 +398,9 @@ void DownloadEngine::poolSocket(const std::shared_ptr<Request>& request, return; } - std::pair<std::string, uint16_t> peerInfo; + Endpoint peerInfo; if (getPeerInfo(peerInfo, socket)) { - poolSocket(peerInfo.first, peerInfo.second, A2STR::NIL, 0, socket, + poolSocket(peerInfo.addr, peerInfo.port, A2STR::NIL, 0, socket, std::move(timeout)); } } @@ -421,9 +420,9 @@ void DownloadEngine::poolSocket(const std::shared_ptr<Request>& request, return; } - std::pair<std::string, uint16_t> peerInfo; + Endpoint peerInfo; if (getPeerInfo(peerInfo, socket)) { - poolSocket(peerInfo.first, peerInfo.second, username, A2STR::NIL, 0, socket, + poolSocket(peerInfo.addr, peerInfo.port, username, A2STR::NIL, 0, socket, options, std::move(timeout)); } } |
