From: Guilherme Maciel Ferreira Date: Tue, 19 Jul 2011 01:19:28 +0000 (-0300) Subject: Code formatting X-Git-Tag: v1.1^2~56 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=d8b4a7e7ff4abf811f192949963463be1ef7e880;p=pingcheck Code formatting --- diff --git a/src/icmp/icmppinger.cpp b/src/icmp/icmppinger.cpp index 3722a48..aeff606 100644 --- a/src/icmp/icmppinger.cpp +++ b/src/icmp/icmppinger.cpp @@ -43,11 +43,11 @@ using I2n::Logger::GlobalLogger; //----------------------------------------------------------------------------- IcmpPinger::IcmpPinger( - boost::asio::io_service &io_service, - string source_network_interface, + io_service &io_serv, + const string &source_network_interface, const int echo_reply_timeout_in_sec ) : - IoService( io_service ), + IoService( io_serv ), DestinationEndpoint(), Socket( IoService, icmp::v4() ), IcmpPacketReceiveTimer( IoService ), @@ -80,14 +80,14 @@ IcmpPinger::~IcmpPinger() } /** - * Ping a destination address from an available local source. + * @brief Ping a destination address from an available local source. * * @param destination_ip The address of the host to ping. * @param done_handler Done handler will be called on successful ping or timeout */ void IcmpPinger::ping( const string &destination_ip, - boost::function< void(bool) > ping_done_callback + function< void(bool) > ping_done_callback ) { BOOST_ASSERT( !destination_ip.empty() ); @@ -206,7 +206,7 @@ void IcmpPinger::handle_ping_done() { // Check ReceivedReply as the timer handler // is also called by Timer.cancel(); - if (ReceivedReply == false) + if ( ReceivedReply == false ) { GlobalLogger.info() << "Request timed out" << endl; @@ -281,13 +281,11 @@ void IcmpPinger::handle_receive_icmp_packet( const size_t &bytes_transferred ) IcmpPacketReceiveTimer.cancel(); } else { - /* - GlobalLogger.notice() << "unknown ICMP reply (src IP: " << icmp_packet.get_ip_header().get_source_address() << ")" - << ". Starting another recieve till timeout." << endl; - */ + // Unknown ICMP reply, start another receive till timeout start_receive(); } - } catch(...) + } + catch ( ... ) { GlobalLogger.notice() << "exception during ICMP parse. Starting another recieve till timeout." << endl; start_receive(); diff --git a/src/icmp/icmppinger.h b/src/icmp/icmppinger.h index a64fd39..54564e7 100644 --- a/src/icmp/icmppinger.h +++ b/src/icmp/icmppinger.h @@ -7,6 +7,8 @@ #ifndef ICMPPINGER_H #define ICMPPINGER_H +#include + #include #include @@ -26,8 +28,8 @@ class IcmpPinger : public Pinger { public: IcmpPinger( - boost::asio::io_service &io_service, - std::string source_network_interface, + boost::asio::io_service &io_serv, + const std::string &source_network_interface, const int echo_reply_timeout_in_sec ); virtual ~IcmpPinger();