Removed one level of indirection provided by PingScheduler::handle_next_ping
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 15 Apr 2011 13:44:51 +0000 (15:44 +0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Fri, 15 Apr 2011 13:44:51 +0000 (15:44 +0200)
src/host/pingscheduler.cpp
src/host/pingscheduler.h

index aa0c302..5a05c34 100644 (file)
@@ -74,19 +74,6 @@ bool PingScheduler::resolve_ping_address()
     return true;
 }
 
-void PingScheduler::setup_ping()
-{
-    BOOST_ASSERT( 1 <= IpList.get_resolved_ip_count() );
-
-    string destination_ip = IpList.get_next_ip();
-    bool ping_success = ping( destination_ip );
-
-    update_ping_statistics( ping_success );
-    update_ping_elapsed_time();
-
-    schedule_next_ping();
-}
-
 bool PingScheduler::ping( const string &destination_ip ) const
 {
     BOOST_ASSERT( !destination_ip.empty() );
@@ -102,17 +89,25 @@ bool PingScheduler::ping( const string &destination_ip ) const
     return pinger.ping( destination_ip );
 }
 
-void PingScheduler::schedule_next_ping()
+void PingScheduler::setup_next_ping()
 {
-    BOOST_ASSERT( 0 < PingIntervalInSec );
+    BOOST_ASSERT( 1 <= IpList.get_resolved_ip_count() );
 
-    (void) NextPingTimer.expires_from_now( seconds( PingIntervalInSec ) );
-    NextPingTimer.async_wait( bind( &PingScheduler::handle_next_ping, this ) );
+    string destination_ip = IpList.get_next_ip();
+    bool ping_success = ping( destination_ip );
+
+    update_ping_statistics( ping_success );
+    update_ping_elapsed_time();
+
+    schedule_next_ping();
 }
 
-void PingScheduler::handle_next_ping()
+void PingScheduler::schedule_next_ping()
 {
-    setup_ping();
+    BOOST_ASSERT( 0 < PingIntervalInSec );
+
+    (void) NextPingTimer.expires_from_now( seconds( PingIntervalInSec ) );
+    NextPingTimer.async_wait( bind( &PingScheduler::setup_next_ping, this ) );
 }
 
 void PingScheduler::update_ping_statistics( const bool ping_success )
index 209fad1..88d7603 100644 (file)
@@ -38,10 +38,9 @@ public:
 
 private:
     bool resolve_ping_address();
-    void setup_ping();
     bool ping( const std::string &destination_ip ) const;
+    void setup_next_ping();
     void schedule_next_ping();
-    void handle_next_ping();
     void update_ping_statistics( const bool ping_success );
     void update_ping_interval();
     void update_ping_elapsed_time();