Commit d698f099 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Adding switch for debug printing of network comm

parent 52934fd8
......@@ -46,6 +46,11 @@ if( NOT DEFINED ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION )
set( ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION OFF CACHE BOOL "VANet with stream server class extension (requires ITADataSources)" )
endif( )
if( NOT DEFINED ITA_VANET_NETWORK_COM_PRINT_DEBUG_INFOS )
set( ITA_VANET_NETWORK_COM_PRINT_DEBUG_INFOS OFF CACHE BOOL "VANet print network commuication infos (for debugging only)" )
endif( )
if( ITA_VANET_CLIENT_VERBOSE )
add_definitions( -DVANET_CLIENT_VERBOSE )
endif( )
......@@ -75,6 +80,10 @@ if( ITA_VANET_WITH_NETAUDIO_STREAM_SERVER_EXTENSION )
add_definitions( -DVANET_WITH_NETAUDIO_STREAM_SERVER )
endif( )
if( ITA_VANET_NETWORK_COM_PRINT_DEBUG_INFOS )
add_definitions( -DVANET_NETWORK_COM_PRINT_DEBUG_INFOS )
endif( )
include_directories( "include" )
if( ITA_VISTA_BUILD_STATIC )
......
......@@ -160,6 +160,11 @@ void CVANetMessage::ReadMessage()
void CVANetMessage::WriteAnswer()
{
#ifdef VANET_NETWORK_COM_PRINT_DEBUG_INFOS
std::cout << "[ VANetMessage ][ DEBUG ] Writing answer" << std::endl;
#endif
VANetCompat::byte* pBuffer = ( VANetCompat::byte* )m_oOutgoing.GetBuffer();
VANetCompat::sint32 iSwapDummy;
......@@ -208,13 +213,24 @@ void CVANetMessage::WriteAnswer()
{
VA_EXCEPT2( NETWORK_ERROR, ex.GetExceptionText() );
}
#ifdef VANET_NETWORK_COM_PRINT_DEBUG_INFOS
std::cout << "[ VANetMessage ][ DEBUG ] Transmitted " << m_oOutgoing.GetBufferSize() << " bytes" << std::endl;
#endif
}
void CVANetMessage::ReadAnswer()
{
#ifdef VANET_NETWORK_COM_PRINT_DEBUG_INFOS
std::cout << "[ VANetMessage ][ DEBUG ] Reading answer" << std::endl;
#endif
VANetCompat::sint32 nMessageSize;
try
{
VANetCompat::sint32 nMessageSize;
int nReturn;
try
{
......@@ -259,6 +275,11 @@ void CVANetMessage::ReadAnswer()
int nMessageID = ReadInt();
assert( nMessageID == m_nMessageId );
m_nMessageId = nMessageID;
#ifdef VANET_NETWORK_COM_PRINT_DEBUG_INFOS
std::cout << "[ VANetMessage ][ DEBUG ] Received " << nMessageSize << " bytes" << std::endl;
#endif
}
int CVANetMessage::GetExceptionMode() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment