diff options
author | Julian Andres Klode <jak@debian.org> | 2018-01-02 21:56:40 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2018-01-03 15:26:51 +0100 |
commit | c9a5a6f2140758c0ed08764a07dd454a8f3ff986 (patch) | |
tree | 8d4e3114995552670873f874e75a480bee023665 /methods | |
parent | 2369d1249ce7119abb30b616182454a56f124f8d (diff) |
connect: Store the IP used when picking a connection
There's no real point in storing the IP address while resolving
it - failure messages include the IP address in any case. Do this
when picking the connection for actual use instead.
Diffstat (limited to 'methods')
-rw-r--r-- | methods/connect.cc | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/methods/connect.cc b/methods/connect.cc index c1a9d347f..07427c651 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -141,6 +141,11 @@ struct Connection std::unique_ptr<MethodFd> Take() { + /* Store the IP we are using.. If something goes + wrong this will get tacked onto the end of the error message */ + std::stringstream ss; + ioprintf(ss, _("[IP: %s %s]"), Name, Service); + Owner->SetIP(ss.str()); return std::move(Fd); } @@ -157,15 +162,6 @@ ResultState Connection::DoConnect(unsigned long TimeOut) // if that addr did timeout before, we do not try it again if(bad_addr.find(std::string(Name)) != bad_addr.end()) return ResultState::TRANSIENT_ERROR; - - /* If this is an IP rotation store the IP we are using.. If something goes - wrong this will get tacked onto the end of the error message */ - if (LastHostAddr->ai_next != 0) - { - std::stringstream ss; - ioprintf(ss, _("[IP: %s %s]"),Name,Service); - Owner->SetIP(ss.str()); - } // Get a socket if ((static_cast<FdFd *>(Fd.get())->fd = socket(Addr->ai_family, Addr->ai_socktype, |