From: Guilherme Maciel Ferreira Date: Thu, 9 Jun 2011 19:41:34 +0000 (-0300) Subject: Added and formatted some error messages X-Git-Tag: v1.1^2~41 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=c40cbef1f6b0d75ff10589917e7374640041cbd5;p=pingcheck Added and formatted some error messages --- diff --git a/src/icmp/icmppinger.cpp b/src/icmp/icmppinger.cpp index 48ee03c..9a1d575 100644 --- a/src/icmp/icmppinger.cpp +++ b/src/icmp/icmppinger.cpp @@ -159,8 +159,7 @@ void IcmpPinger::send_echo_request( const IcmpPacket &icmp_packet ) size_t bytes_sent = Socket.send_to( data, DestinationEndpoint ); if ( bytes_sent != buffer_size( data ) ) { - GlobalLogger.error() << "Error: fail sending ping data." - << endl; + GlobalLogger.error() << "Error: fail sending ping data." << endl; } } catch ( const exception &ex ) @@ -258,8 +257,7 @@ void IcmpPinger::handle_receive_icmp_packet( const size_t &bytes_transferred ) // ICMP packets from the host we had ping). if ( icmp_packet.match( IcmpType_EchoReply, Identifier, SequenceNumber, - DestinationEndpoint.address()) - ) + DestinationEndpoint.address() ) ) { ReceivedReply = true; @@ -271,8 +269,7 @@ void IcmpPinger::handle_receive_icmp_packet( const size_t &bytes_transferred ) } else if ( icmp_packet.match( IcmpType_DestinationUnreachable, Identifier, SequenceNumber, - DestinationEndpoint.address() - ) ) + DestinationEndpoint.address() ) ) { ReceivedReply = true; @@ -281,7 +278,8 @@ void IcmpPinger::handle_receive_icmp_packet( const size_t &bytes_transferred ) set_ping_status( PingStatus_FailureDestinationUnreachable ); IcmpPacketReceiveTimer.cancel(); - } else + } + else { // Unknown ICMP reply, start another receive till timeout start_receive(); @@ -380,6 +378,8 @@ bool IcmpPinger::select_source_network_interface( ); if ( ret == -1 ) { + GlobalLogger.error() << "Error: could not bind pinger to interface " + << source_network_interface << endl; return false; }