]> granicus.if.org Git - pdns/commitdiff
ixfrdist: Also respect the AXFR timeout for the chunk's length
authorRemi Gacogne <remi.gacogne@powerdns.com>
Sun, 25 Feb 2018 15:41:36 +0000 (16:41 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 26 Feb 2018 05:48:45 +0000 (06:48 +0100)
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)

pdns/resolver.cc
pdns/resolver.hh

index b40d5b7da09362c9df672f0d29f0368a1a713a52..6ab89c87be21620af0168285a512fc5fcc55172b 100644 (file)
@@ -452,7 +452,7 @@ int AXFRRetriever::getChunk(Resolver::res_t &res, vector<DNSRecord>* 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];
 }
 
index 6dd55ec2535a29fe91e51e8c9c74860ee0f0e61a..59dec932705469dfcdf5984ef9ec98189b7cf69a 100644 (file)
@@ -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<char> d_buf;