From: Peter van Dijk Date: Mon, 8 Jul 2019 09:16:29 +0000 (+0200) Subject: Revert "Rearrange; to avoid uninitialized var and bail out after exception," X-Git-Tag: dnsdist-1.4.0-rc1~63^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73428b7a2ff4824176bdcf1edd271d9888c3dd4d;p=thirdparty%2Fpdns.git Revert "Rearrange; to avoid uninitialized var and bail out after exception," This reverts commit cb22b82e6e97374e0eadcc03c56dd8e7f1328bf3. --- diff --git a/pdns/communicator.hh b/pdns/communicator.hh index 831b2cecf5..2cb0f70feb 100644 --- a/pdns/communicator.hh +++ b/pdns/communicator.hh @@ -258,25 +258,26 @@ public: this->resolve_name(&addresses, name); if(b) { - b->lookup(QType(QType::ANY),name); - while (true) { - try { + b->lookup(QType(QType::ANY),name); + bool ok; + do { DNSZoneRecord rr; - if (!b->get(rr)) - break; - if (rr.dr.d_type == QType::A || rr.dr.d_type == QType::AAAA) - addresses.push_back(rr.dr.d_content->getZoneRepresentation()); // SOL if you have a CNAME for an NS - } - // After an exception, b can be inconsistent so break - catch (PDNSException &ae) { - g_log << Logger::Error << "Skipping record(s): " << ae.reason << endl; - break; - } - catch (std::exception &e) { - g_log << Logger::Error << "Skipping record(s): " << e.what() << endl; - break; - } - } + try { + ok = b->get(rr); + } + catch (PDNSException &ae) { + g_log << Logger::Error << "Skipping record: " << ae.reason << endl; + continue; + } + catch (std::exception &e) { + g_log << Logger::Error << "Skipping record: " << e.what() << endl; + continue; + } + if (ok) { + if (rr.dr.d_type == QType::A || rr.dr.d_type == QType::AAAA) + addresses.push_back(rr.dr.d_content->getZoneRepresentation()); // SOL if you have a CNAME for an NS + } + } while (ok); } return addresses; }