]> granicus.if.org Git - pdns/commitdiff
ixfrdist AXFR timeout: pass the remaining time to getChunk
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 16 Feb 2018 17:50:37 +0000 (18:50 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Fri, 16 Feb 2018 17:50:37 +0000 (18:50 +0100)
pdns/ixfrdist.cc

index 619471cbd23d0a09ffb2c352cc7fe5867f4e034d..f2f6151129ff7db95a958c1fea953fb21a54b14f 100644 (file)
@@ -253,10 +253,8 @@ void updateThread() {
         vector<DNSRecord> chunk;
         records_t records;
         time_t t_start = time(nullptr);
-        while(axfr.getChunk(nop, &chunk)) {
-          if (time(nullptr) - t_start > g_axfrTimeout) {
-            throw PDNSException("AXFR timeout exceeded");
-          }
+        time_t axfr_now = time(nullptr);
+        while(axfr.getChunk(nop, &chunk, (axfr_now - t_start + g_axfrTimeout))) {
           for(auto& dr : chunk) {
             if(dr.d_type == QType::TSIG)
               continue;
@@ -267,6 +265,10 @@ void updateThread() {
               soa = getRR<SOARecordContent>(dr);
             }
           }
+          axfr_now = time(nullptr);
+          if (axfr_now - t_start > g_axfrTimeout) {
+            throw PDNSException("Total AXFR time exceeded!");
+          }
         }
         if (soa == nullptr) {
           cerr<<"[WARNING] No SOA was found in the AXFR of "<<domain<<endl;