DnsMasterItem DnsMaster::TheOnlyInstance;
void DnsMaster::create_master(const IoServiceItem &io_serv,
- const boost::asio::ip::address &name_server,
- const int resolved_ip_ttl_threshold,
- const int max_address_resolution_attempts,
- const std::string &cache_file)
+ const boost::asio::ip::address &default_name_server,
+ const int resolved_ip_ttl_threshold,
+ const int max_address_resolution_attempts,
+ const std::string &cache_file)
{
if (TheOnlyInstance)
{
GlobalLogger.info() << "Creating DNS Cache and Master";
DnsCacheItem cache( new DnsCache(io_serv, cache_file) );
TheOnlyInstance.reset( new DnsMaster(io_serv,
- name_server,
+ default_name_server,
resolved_ip_ttl_threshold,
max_address_resolution_attempts,
cache)
DnsMaster::DnsMaster(const IoServiceItem &io_serv,
- const boost::asio::ip::address &name_server,
+ const boost::asio::ip::address &default_name_server,
const int resolved_ip_ttl_threshold,
const int max_address_resolution_attempts,
const DnsCacheItem &cache)
: IoService( io_serv )
- , NameServer( name_server )
+ , DefaultNameServer( default_name_server )
, ResolvedIpTtlThreshold( resolved_ip_ttl_threshold )
, MaxAddressResolutionAttempts( max_address_resolution_attempts )
, Cache(cache)
}
-ResolverItem& DnsMaster::get_resolver_for( const std::string &hostname,
- const DnsIpProtocol &protocol )
+ResolverItem& DnsMaster::get_resolver_for(const std::string &hostname,
+ const DnsIpProtocol &protocol)
{
DnsMasterItem master = get_instance();
hostname,
protocol,
Cache,
- NameServer) );
+ DefaultNameServer) );
master->ResolverMap[key] = new_resolver;
}
}
return master->ResolverMap[key];
}
+// create resolver but do not remember it in ResolverMap
+ResolverItem DnsMaster::get_recursor_for(const std::string &hostname,
+ const DnsIpProtocol &protocol,
+ const boost::asio::ip::address &name_server)
+{
+ ResolverItem new_resolver( new DnsResolver(IoService,
+ hostname,
+ protocol,
+ Cache,
+ name_server) );
+ return new_resolver;
+}
+
/**
* return true if given hostname string actually is an IP
*