From f2457bfb4ea9f20fefdb83be2adecdcba220273f Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 16 Feb 2018 18:50:37 +0100 Subject: [PATCH] ixfrdist AXFR timeout: pass the remaining time to getChunk --- pdns/ixfrdist.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pdns/ixfrdist.cc b/pdns/ixfrdist.cc index 619471cbd2..f2f6151129 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 "<