From: Guilherme Maciel Ferreira Date: Fri, 3 Jun 2011 20:00:41 +0000 (-0300) Subject: Replaced the assert by a conditional X-Git-Tag: v1.0~3 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=c935ab92117292025720af105878a14bc3326352;p=pingcheck Replaced the assert by a conditional - because the amount of data received can differ from the amount we expect, but this cannot make the application to abort. --- diff --git a/src/icmp/icmpmessagepayload.cpp b/src/icmp/icmpmessagepayload.cpp index 6a225ff..2de1fd9 100644 --- a/src/icmp/icmpmessagepayload.cpp +++ b/src/icmp/icmpmessagepayload.cpp @@ -10,8 +10,11 @@ #include +#include + using namespace std; using boost::scoped_array; +using I2n::Logger::GlobalLogger; //----------------------------------------------------------------------------- // IcmpMessagePayload @@ -106,7 +109,12 @@ istream& IcmpMessagePayload::read( istream &is ) char *data_array = reinterpret_cast ( Payload.get() ); (void) is.read( data_array, PayloadSizeInBytes ); - BOOST_ASSERT( static_cast(is.gcount()) == PayloadSizeInBytes ); + size_t data_received_in_bytes = static_cast( is.gcount() ); + if ( data_received_in_bytes != PayloadSizeInBytes ) + { + GlobalLogger.error() << "Error: expecting " << PayloadSizeInBytes + << " bytes, but received " << is.gcount() << " bytes" << endl; + } return is; }