// --> all are up-to-date
return "";
}
+
+std::string DnsCache::get_cname_chain_str(const std::string &hostname)
+{
+ std::stringstream temp;
+ temp << hostname;
+ std::string current_host = hostname;
+ Cname current_cname;
+ int n_recursions = 0;
+ int max_recursion_count = DnsMaster::get_instance()
+ ->get_max_recursion_count();
+ while (true)
+ {
+ if (n_recursions >= max_recursion_count)
+ {
+ temp << "...";
+ break;
+ }
+
+ current_cname = get_cname(current_host, false);
+ if (current_cname.Host.empty())
+ break;
+ else
+ {
+ current_host = current_cname.Host;
+ temp << "-->" << current_host;
+ }
+ }
+ return temp.str();
+}
const bool check_up_to_date=false);
std::string get_first_outdated_cname(const std::string &hostname,
const uint32_t ttl_thresh);
+ std::string get_cname_chain_str(const std::string &hostname);
// variables
private:
return MaxRecursionCount;
}
+std::string DnsMaster::get_cname_chain_str(const std::string &hostname)
+{
+ DnsMasterItem master = get_instance();
+ if (master)
+ return master->Cache->get_cname_chain_str(hostname);
+ else
+ return hostname;
+}
int get_max_address_resolution_attempts() const;
int get_max_recursion_count() const;
+ // access to Cache
+ static std::string get_cname_chain_str(const std::string &hostname);
+
// variables
private:
IoServiceItem IoService;
NPingers.increase();
GlobalLogger.notice() << LogPrefix << "No reply from host, "
- << "switching to burst ping mode with longer timeouts";
+ << "switching to burst ping mode with longer timeouts ("
+ << DnsMaster::get_cname_chain_str(DestinationAddress) << ")";
GlobalLogger.debug() << LogPrefix << "- Increasing ping number to: "
<< NPingers;
#include <logfunc.hpp>
+#include "dns/dnsmaster.h"
+
#include "boost_assert_handler.h"
using namespace std;
if (has_changed)
GlobalLogger.notice() << "Status (" << HostsDownList.size()
<< "/" << HostsDownLimit << " down): now up again is "
- << host_address << endl;
+ << DnsMaster::get_cname_chain_str(host_address) << endl;
else // less important so log only at info level
GlobalLogger.info() << "Status (" << HostsDownList.size()
<< "/" << HostsDownLimit << " down): still up is "
- << host_address << endl;
+ << DnsMaster::get_cname_chain_str(host_address) << endl;
if ( !exceeded_host_down_limit() )
{
// report this always at notice level
GlobalLogger.notice() << "Status (" << HostsDownList.size()
<< "/" << HostsDownLimit << " down): down is "
- << host_address << endl;
+ << DnsMaster::get_cname_chain_str(host_address) << endl;
if ( exceeded_host_down_limit() )
{
test_linkstatus
${CMAKE_SOURCE_DIR}/src/boost_assert_handler.cpp
${CMAKE_SOURCE_DIR}/src/link/linkstatus.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/hostaddress.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/timetolive.cpp
+ ${CMAKE_SOURCE_DIR}/src/host/pinger.cpp
+ ${CMAKE_SOURCE_DIR}/src/host/pingprotocol.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/dnsipprotocol.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/dnscache.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/resolverbase.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/dnsresolver.cpp
+ ${CMAKE_SOURCE_DIR}/src/dns/dnsmaster.cpp
)
# linker: link the program against the libraries
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
-find_package(Boost 1.44 COMPONENTS unit_test_framework system program_options REQUIRED)
+find_package(Boost 1.44 COMPONENTS unit_test_framework system program_options date_time serialization REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})