#include "host/pingrotate.h"
 
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 
 #include "boost_assert_handler.h"
 #include "dns/dnsresolverfactory.h"
     Nameserver( nameserver ),
     ResolvedIpTtlThreshold( resolved_ip_ttl_threshold ),
     PingReplyTimeout( ping_reply_timeout ),
-    ProtocolList( protocol_list ),
+    ProtocolRotate( protocol_list.size() ),
     Ping(),
     PingDoneCallback()
 {
     BOOST_ASSERT( !nameserver.empty() );
     BOOST_ASSERT( 0 < protocol_list.size() );
 
+    // fill circular buffer with protocols
+    BOOST_FOREACH( const PingProtocol &prot, protocol_list )
+        ProtocolRotate.push_back(prot);
+
     init_ping_protocol();
 }
 
 
 void PingRotate::get_next_ping_protocol()
 {
-    if ( 1 <= ProtocolList.size() )
-    {
-        PingProtocol ping_protocol = ProtocolList.front();
+    PingProtocol ping_protocol = ProtocolRotate.front();
+    ProtocolRotate.pop_front();
+    ProtocolRotate.push_back(ping_protocol);
 
-        ProtocolList.pop_front();
+    Ping = PingerFactory::createPinger( ping_protocol, IoService, NetworkInterfaceName, PingReplyTimeout );
 
-        Ping = PingerFactory::createPinger( ping_protocol, IoService, NetworkInterfaceName, PingReplyTimeout );
-
-        update_dns_resolver( ping_protocol );
-    }
+    update_dns_resolver( ping_protocol );
 }
 
 bool PingRotate::can_change_ping_protocol() const
 
 #include <boost/asio.hpp>
 #include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/circular_buffer.hpp>
 
 #include "dns/dnsresolver.h"
 #include "host/pinger.h"
 // PingRotate
 //-----------------------------------------------------------------------------
 
+typedef boost::circular_buffer<PingProtocol> CircularProtocolList;
+
 /**
  * @brief This class is a wrapper to the Pingers, and serves to alternate
  * between protocols.
     /// timeout for ping reply
     const int PingReplyTimeout;
     /// The list of protocols to ping
-    PingProtocolList ProtocolList;
+    CircularProtocolList ProtocolRotate;
     /// Internal boost pinger object
     PingerItem Ping;
     /// The callback function