From: Pieter Lexis Date: Fri, 16 Feb 2018 17:50:37 +0000 (+0100) Subject: ixfrdist AXFR timeout: pass the remaining time to getChunk X-Git-Tag: dnsdist-1.3.0~97^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2457bfb4ea9f20fefdb83be2adecdcba220273f;p=pdns ixfrdist AXFR timeout: pass the remaining time to getChunk --- diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index 619471cbd..f2f615112 100644 --- a/pdns/ixfrdist.cc +++ b/pdns/ixfrdist.cc @@ -253,10 +253,8 @@ void updateThread() { vector 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(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 "<