From: Christian Herdtweck Date: Thu, 28 May 2015 12:49:21 +0000 (+0200) Subject: moved adjustment of PingTimeout to right place in PingScheduler; X-Git-Url: http://developer.intra2net.com/git/?p=pingcheck;a=commitdiff_plain;h=d10644b935b4fd07113c9873693b84302dacebfc moved adjustment of PingTimeout to right place in PingScheduler; re-added line I had deleted erroneously; compiles again now --- diff --git a/src/host/hoststatus.cpp b/src/host/hoststatus.cpp index 3826712..32238d4 100644 --- a/src/host/hoststatus.cpp +++ b/src/host/hoststatus.cpp @@ -344,4 +344,5 @@ void HostStatus::analyze_ping_congestion_count() if ( PingCongestionCount > limit ) ExceededPingCongestionLimit = true; else + ExceededPingCongestionLimit = false; } diff --git a/src/host/pingscheduler.cpp b/src/host/pingscheduler.cpp index e64725a..d259f2e 100644 --- a/src/host/pingscheduler.cpp +++ b/src/host/pingscheduler.cpp @@ -153,7 +153,7 @@ void PingScheduler::stop_pinging() /** * @brief stop all pingers and remove them from Pingers variable which will * proboably cause their destruction - * + * * Pingers is empty afterwards */ void PingScheduler::clear_pingers() @@ -330,7 +330,6 @@ void PingScheduler::ping_done_handler( const PingStatus &result, << NPingers << " done with result " << to_string(edited_result); // post-processing - // can call update_ping_interval only after update_ping_statistics! HostAnalyzer.update_ping_statistics( edited_result, ping_duration_us ); // prepare next ping only after all pingers are done @@ -343,6 +342,7 @@ void PingScheduler::ping_done_handler( const PingStatus &result, << "--------------------------------------------------------------"; // update variables for next ping: number of pings, delay, protocol + // do this only after call to update_ping_statistics! update_ping_protocol(); update_ping_interval(); update_ping_number(); @@ -384,9 +384,6 @@ void PingScheduler::update_ping_interval() GlobalLogger.debug() << LogPrefix << "- Speeding up ping interval to: " << PingIntervalInSec << "s"; - PingReplyTimeout = PingReplyTimeoutOrig * PingTimeoutFactor; - GlobalLogger.debug() << LogPrefix << "- Increase ping timeout to " - << PingReplyTimeout << "s"; } else { @@ -394,14 +391,13 @@ void PingScheduler::update_ping_interval() GlobalLogger.debug() << LogPrefix << "- Stick to the original ping " << "interval: " << PingIntervalInSec << "s"; - PingReplyTimeout = PingReplyTimeoutOrig; - GlobalLogger.debug() << LogPrefix << "- Reset ping timeout to " - << PingReplyTimeout << "s"; } } /** in case of congested line, increase number of pings * + * also increases ping timeout if line is congested + * * CAUTION! Only call this after clear_pingers !!! * */ void PingScheduler::update_ping_number() @@ -420,9 +416,14 @@ void PingScheduler::update_ping_number() { NPingers.increase(); - GlobalLogger.notice() << LogPrefix << "Line appears congested!"; + GlobalLogger.notice() << LogPrefix << "No reply from host, " + << "switching to burst ping mode with longer timeouts"; GlobalLogger.debug() << LogPrefix << "- Increasing ping number to: " << NPingers; + + PingReplyTimeout = PingReplyTimeoutOrig * PingTimeoutFactor; + GlobalLogger.debug() << LogPrefix << "- Increase ping timeout to " + << PingReplyTimeout << "s"; } else { @@ -430,8 +431,13 @@ void PingScheduler::update_ping_number() GlobalLogger.debug() << LogPrefix << "- Stick to the original ping " << "number: " << NPingers; + + PingReplyTimeout = PingReplyTimeoutOrig; + GlobalLogger.debug() << LogPrefix << "- Reset ping timeout to " + << PingReplyTimeout << "s"; } + // tell host analyzer so it expects the correct number of ping results HostAnalyzer.set_n_parallel_pings(NPingers); }