Commit a68b0e89 authored by Jonas Stienen's avatar Jonas Stienen
Browse files

Removing (now) useless exception raise

parent 79ad52a9
......@@ -123,16 +123,19 @@ void CVANetMessage::ReadMessage()
if( nMessageSize > ( int ) m_vecIncomingBuffer.size() )
m_vecIncomingBuffer.resize( nMessageSize );
int iBytesReceivedTotal = 0;
while( nMessageSize > iBytesReceivedTotal )
int iBytesReadTotal = 0;
while( nMessageSize != iBytesReadTotal )
{
int iIncommingBytes = m_pConnection->WaitForIncomingData( 0 );
int iBytesReceived = m_pConnection->ReadRawBuffer( &m_vecIncomingBuffer[ iBytesReceivedTotal ], iIncommingBytes );
iBytesReceivedTotal += iBytesReceived;
int iBytesRead = 0;
if( iBytesReadTotal + iIncommingBytes > nMessageSize )
iBytesRead = m_pConnection->ReadRawBuffer( &m_vecIncomingBuffer[ iBytesReadTotal ], nMessageSize - iBytesReadTotal ); // read residual bytes
else
iBytesRead = m_pConnection->ReadRawBuffer( &m_vecIncomingBuffer[ iBytesReadTotal ], iIncommingBytes ); // read all incominb bytes
iBytesReadTotal += iBytesRead;
}
if( iBytesReceivedTotal != nMessageSize )
VA_EXCEPT2( NETWORK_ERROR, "Reading message, but received less bytes than expected." );
assert( iBytesReadTotal == nMessageSize );
m_oIncoming.SetBuffer( ( VistaType::byte* ) &m_vecIncomingBuffer[ 0 ], nMessageSize, false );
}
......
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