started parallel pings, not quite done yet since need to delay them
[pingcheck] / src / host / pingscheduler.h
index 37d94a1..ad9f63a 100644 (file)
@@ -36,6 +36,8 @@ on this file might be covered by the GNU General Public License.
 #include "host/pingprotocol.h"
 #include "dns/resolverbase.h"
 
+typedef std::list<PingerItem> pinger_list;
+
 //-----------------------------------------------------------------------------
 // PingScheduler
 //-----------------------------------------------------------------------------
@@ -58,7 +60,9 @@ public:
             const int ping_fail_percentage_limit,
             const int ping_reply_timeout,
             LinkStatusItem link_analyzer,
-            const int first_delay
+            const int first_delay,
+            const int n_parallel_pings,
+            const int parallel_ping_delay
     );
     ~PingScheduler();
 
@@ -79,6 +83,7 @@ private:
     void get_next_ping_protocol();
     bool can_change_ping_protocol() const;
 
+    void prepare_next_ping();
     void update_dns_resolver( PingProtocol current_protocol );
 
     void ping_when_ready();
@@ -88,6 +93,7 @@ private:
 
     void update_log_prefix();
     void cancel_resolve(const bool force_cancel);
+    void clear_pingers();
 
     //
     // Attributes
@@ -118,8 +124,14 @@ private:
     HostStatus HostAnalyzer;
     /// The Dns resolver
     ResolverItem Resolver;
-    /// The actual pinger
-    PingerItem Ping;
+    /// vector of pingers
+    pinger_list Pingers;
+    /// number of pingers that work in parallel
+    int NPingers;
+    /// number of results from pingers
+    int NPingersDone;
+    /// delay (in ms) between pings to same IP
+    int ParallelPingDelay;
     /// a flag whether we should ping as soon as dns is ready
     bool WantToPing;
     /// Prefix to log messages for quicker analysis/debugging