From: Remi Gacogne Date: Sun, 25 Feb 2018 15:41:36 +0000 (+0100) Subject: ixfrdist: Also respect the AXFR timeout for the chunk's length X-Git-Tag: rec-4.1.2~5^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c3277faecd4b5fc43717cbcd0fd56ff5aef9b01;p=thirdparty%2Fpdns.git ixfrdist: Also respect the AXFR timeout for the chunk's length We used to apply the default timeout of 10s to retrieve the chunk's length even if we were passed a different one. (cherry picked from commit b726c12720f31a6cdd94a06ccb3a427a96f19669) --- diff --git a/pdns/resolver.cc b/pdns/resolver.cc index b40d5b7da0..6ab89c87be 100644 --- a/pdns/resolver.cc +++ b/pdns/resolver.cc @@ -452,7 +452,7 @@ int AXFRRetriever::getChunk(Resolver::res_t &res, vector* records, ui return false; // d_sock is connected and is about to spit out a packet - int len=getLength(); + int len=getLength(timeout); if(len<0) throw ResolverException("EOF trying to read axfr chunk from remote TCP client"); @@ -567,9 +567,9 @@ void AXFRRetriever::connect() // d_sock now connected } -int AXFRRetriever::getLength() +int AXFRRetriever::getLength(uint16_t timeout) { - timeoutReadn(2); + timeoutReadn(2, timeout); return (unsigned char)d_buf[0]*256+(unsigned char)d_buf[1]; } diff --git a/pdns/resolver.hh b/pdns/resolver.hh index 6dd55ec253..59dec93270 100644 --- a/pdns/resolver.hh +++ b/pdns/resolver.hh @@ -94,7 +94,7 @@ class AXFRRetriever : public boost::noncopyable private: void connect(); - int getLength(); + int getLength(uint16_t timeout); void timeoutReadn(uint16_t bytes, uint16_t timeoutsec=10); shared_array d_buf;