Added and formatted some error messages
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Thu, 9 Jun 2011 19:41:34 +0000 (16:41 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Thu, 28 Jul 2011 03:46:23 +0000 (00:46 -0300)
src/icmp/icmppinger.cpp

index 48ee03c..9a1d575 100644 (file)
@@ -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;
     }