From 5b197e9de5376e191018562309e2d42123c27a1d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 3 Jan 2018 16:28:59 +0100 Subject: Correctly report transient errors again Commit 47c0bdc310c8cd62374ca6e6bb456dd183bdfc07 ("report transient errors as transient error") accidentally changed some connection failures to become non-transient, because the result of the error checks where being ignored and then fatal error was returned if an error was pending - even if that error was trivial. After the merge of pu/happy-eyeballs2a this becomes a lot clearer, and easy to fix. Gbp-Dch: ignore Regression-Of: 47c0bdc310c8cd62374ca6e6bb456dd183bdfc07 --- methods/connect.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'methods') diff --git a/methods/connect.cc b/methods/connect.cc index 334a1d3f3..519031ace 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -447,6 +447,7 @@ static ResultState ConnectToHostname(std::string const &Host, int const Port, // When we have an IP rotation stay with the last IP. auto Addresses = OrderAddresses(LastUsed != nullptr ? LastUsed : LastHostAddr); std::list Conns; + ResultState Result = ResultState::SUCCESSFUL; for (auto Addr : Addresses) { @@ -456,13 +457,16 @@ static ResultState ConnectToHostname(std::string const &Host, int const Port, Conns.push_back(std::move(Conn)); - if (WaitAndCheckErrors(Conns, Fd, Owner->ConfigFindI("ConnectionAttemptDelayMsec", 250), false) == ResultState::SUCCESSFUL) + Result = WaitAndCheckErrors(Conns, Fd, Owner->ConfigFindI("ConnectionAttemptDelayMsec", 250), false); + + if (Result == ResultState::SUCCESSFUL) return ResultState::SUCCESSFUL; } - if (WaitAndCheckErrors(Conns, Fd, TimeOut * 1000, true) == ResultState::SUCCESSFUL) - return ResultState::SUCCESSFUL; - + if (!Conns.empty()) + return WaitAndCheckErrors(Conns, Fd, TimeOut * 1000, true); + if (Result != ResultState::SUCCESSFUL) + return Result; if (_error->PendingError() == true) return ResultState::FATAL_ERROR; _error->Error(_("Unable to connect to %s:%s:"), Host.c_str(), ServStr); -- cgit v1.2.3