const DNSName& domain,
const TSIGTriplet& tt,
const ComboAddress* laddr,
- size_t maxReceivedBytes)
+ size_t maxReceivedBytes,
+ uint16_t timeout)
: d_tsigVerifier(tt, remote, d_trc), d_receivedBytes(0), d_maxReceivedBytes(maxReceivedBytes)
{
ComboAddress local;
throw ResolverException("Error creating socket for AXFR request to "+d_remote.toStringWithPort());
d_buf = shared_array<char>(new char[65536]);
d_remote = remote; // mostly for error reporting
- this->connect();
+ this->connect(timeout);
d_soacount = 0;
vector<uint8_t> packet;
throw ResolverException("Partial write on AXFR request to "+d_remote.toStringWithPort());
}
- int res = waitForData(d_sock, 10, 0);
+ int res = waitForData(d_sock, timeout, 0);
if(!res)
throw ResolverException("Timeout waiting for answer from "+d_remote.toStringWithPort()+" during AXFR");
}
}
-void AXFRRetriever::connect()
+void AXFRRetriever::connect(uint16_t timeout)
{
setNonBlocking( d_sock );
if(!err)
goto done;
- err=waitForRWData(d_sock, false, 10, 0); // wait for writeability
+ err=waitForRWData(d_sock, false, timeout, 0); // wait for writeability
if(!err) {
try {
throw ResolverException("Timeout connecting to server");
}
else if(err < 0) {
- throw ResolverException("Error connecting: "+string(strerror(err)));
+ throw ResolverException("Error connecting: "+string(strerror(errno)));
}
else {
Utility::socklen_t len=sizeof(err);
const DNSName& zone,
const TSIGTriplet& tt = TSIGTriplet(),
const ComboAddress* laddr = NULL,
- size_t maxReceivedBytes=0);
+ size_t maxReceivedBytes=0,
+ uint16_t timeout=10);
~AXFRRetriever();
int getChunk(Resolver::res_t &res, vector<DNSRecord>* records=0, uint16_t timeout=10);
private:
- void connect();
+ void connect(uint16_t timeout);
int getLength(uint16_t timeout);
void timeoutReadn(uint16_t bytes, uint16_t timeoutsec=10);
if (local == ComboAddress())
local = getQueryLocalAddress(master.sin4.sin_family, 0);
- AXFRRetriever axfr(master, zoneName, tt, &local, maxReceivedBytes);
+ AXFRRetriever axfr(master, zoneName, tt, &local, maxReceivedBytes, axfrTimeout);
unsigned int nrecords=0;
Resolver::res_t nop;
vector<DNSRecord> chunk;