From 4f5cde492575eb62d8252df6ec413753f750e977 Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Fri, 12 Jan 2018 18:44:21 +0800 Subject: [PATCH] import test for IXFR ending --- pdns/ixfr.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pdns/ixfr.cc b/pdns/ixfr.cc index ab0fc6210..8d02a8bf5 100644 --- a/pdns/ixfr.cc +++ b/pdns/ixfr.cc @@ -171,7 +171,8 @@ vector, vector > > getIXFRDeltas(const ComboAd int8_t ixfrInProgress = -2; for(;;) { - if (!ixfrInProgress) + // IXFR end + if (ixfrInProgress >= 0) break; if(s.read((char*)&len, sizeof(len)) != sizeof(len)) @@ -217,10 +218,15 @@ vector, vector > > getIXFRDeltas(const ComboAd return ret; } masterSOA = sr; - } else { + } else if (r.first.d_type == QType::SOA) { + auto sr = getRR(r.first); + if (!sr) { + throw std::runtime_error("Error getting the content of SOA record of IXFR answer for zone '"+zone.toLogString()+"' from master '"+master.toStringWithPort()+"'"); + } + // we hit the last SOA record - // ixfr is considered to be done if we hit the last SOA record twice - if (r.first.d_type == QType::SOA && masterSOA->d_st.serial == getRR(r.first)->d_st.serial) { + // IXFR is considered to be done if we hit the last SOA record twice + if (masterSOA->d_st.serial == sr->d_st.serial) { ixfrInProgress++; } } -- 2.40.0