From e7578c0d01098d0beacee52a3c9e07614f4cb976 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 4 Feb 2015 12:02:11 +0100 Subject: [PATCH] limit line length of new files to 80 characters --- src/icmp/icmppacketdistributor.cpp | 43 ++++++++++++++++++++++------------- src/icmp/icmppacketdistributor.h | 3 +- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/icmp/icmppacketdistributor.cpp b/src/icmp/icmppacketdistributor.cpp index 7850305..26c4178 100644 --- a/src/icmp/icmppacketdistributor.cpp +++ b/src/icmp/icmppacketdistributor.cpp @@ -135,7 +135,7 @@ IcmpPacketDistributor::IcmpPacketDistributor( void IcmpPacketDistributor::register_receive_handler() { - // Waiting for a reply, We prepare the buffer to receive up to SOCKET_BUFFER_SIZE bytes + // wait for reply, prepare buffer to receive up to SOCKET_BUFFER_SIZE bytes Socket->async_receive( ReplyBuffer.prepare( SOCKET_BUFFER_SIZE ), boost::bind( &IcmpPacketDistributor::handle_receive, this, @@ -144,8 +144,9 @@ void IcmpPacketDistributor::register_receive_handler() ); } -void IcmpPacketDistributor::handle_receive( const boost::system::error_code &error, - const size_t &bytes_transferred ) +void IcmpPacketDistributor::handle_receive( + const boost::system::error_code &error, + const size_t &bytes_transferred ) { if ( error ) { @@ -172,23 +173,27 @@ void IcmpPacketDistributor::handle_receive( const boost::system::error_code &err } // Decode the reply packet. - IcmpPacketItem icmp_packet = IcmpPacketFactory::create_icmp_packet( Protocol, is ); + IcmpPacketItem icmp_packet = IcmpPacketFactory::create_icmp_packet( + Protocol, is ); if ( !icmp_packet ) { - GlobalLogger.warning() << "Ignoring broken ICMP packet" << std::endl; + GlobalLogger.warning() << "Ignoring broken ICMP packet" + << std::endl; } // check which pinger wants this packet bool packet_matches = false; BOOST_FOREACH( IcmpPingerItem pinger, PingerList ) { - packet_matches |= pinger->handle_receive_icmp_packet(icmp_packet, bytes_received); + packet_matches |= pinger->handle_receive_icmp_packet(icmp_packet, + bytes_received); if (packet_matches) break; } if (!packet_matches) - GlobalLogger.warning() << "Packet did not match any pinger" << std::endl; + GlobalLogger.warning() << "Packet did not match any pinger" + << std::endl; catch ( ... ) { @@ -204,10 +209,12 @@ bool IcmpPacketDistributor::register_pinger( const IcmpPingerItem new_pinger ) std::pair result = PingerList.insert(new_pinger); bool was_new = result.second; if (was_new) - GlobalLogger.info() << "Register new pinger with IcmpPacketDistributor" << std::endl; + GlobalLogger.info() << "Register new pinger with IcmpPacketDistributor" + << std::endl; else - GlobalLogger.warning() << "Pinger to register was already known in IcmpPacketDistributor" - << std::endl; + GlobalLogger.warning() + << "Pinger to register was already known in IcmpPacketDistributor" + << std::endl; return was_new; } @@ -217,10 +224,12 @@ bool IcmpPacketDistributor::unregister_pinger( const IcmpPingerItem old_pinger ) int n_erased = PingerList.erase(old_pinger); bool was_erased = n_erased > 0; if (was_erased) - GlobalLogger.info() << "Removed pinger from IcmpPacketDistributor" << std::endl; + GlobalLogger.info() << "Removed pinger from IcmpPacketDistributor" + << std::endl; else - GlobalLogger.warning() << "Could not find pinger to remove from IcmpPacketDistributor" - << std::endl; + GlobalLogger.warning() + << "Could not find pinger to remove from IcmpPacketDistributor" + << std::endl; return was_erased; } @@ -243,14 +252,16 @@ void IcmpPacketDistributor::clean_up() PingerList.clear(); boost::system::error_code error; - //Socket->shutdown(icmp::socket::shutdown_both, error); // both=send and receive + //Socket->shutdown(icmp::socket::shutdown_both, error); //both=send&receive //if ( error ) - // GlobalLogger.warning() << "Received error " << error << " when shutting down ICMP socket"; + // GlobalLogger.warning() << "Received error " << error + // << " when shutting down ICMP socket"; // always gave an error system:9 (probably EBADF: Bad file descriptor) Socket->close(error); if ( error ) - GlobalLogger.warning() << "Received error " << error << " when closing ICMP socket"; + GlobalLogger.warning() << "Received error " << error + << " when closing ICMP socket"; } IcmpPacketDistributor::~IcmpPacketDistributor() diff --git a/src/icmp/icmppacketdistributor.h b/src/icmp/icmppacketdistributor.h index 0147cc1..c8cfec7 100644 --- a/src/icmp/icmppacketdistributor.h +++ b/src/icmp/icmppacketdistributor.h @@ -36,7 +36,8 @@ using boost::asio::ip::icmp; // for each IP protocol (v4/v6) and each network interface (string), // there can only be one IcmpPacketDistributor instance -typedef std::pair DistributorInstanceIdentifier; +typedef std::pair + DistributorInstanceIdentifier; struct IcmpPacketDistributorInstanceIdentifierComparator { -- 1.7.1