MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / ReadMessageData

Method ReadMessageData

neo/framework/async/MsgChannel.cpp:367–406  ·  view source on GitHub ↗

=============== idMsgChannel::ReadMessageData ================ */

Source from the content-addressed store, hash-verified

365================
366*/
367bool idMsgChannel::ReadMessageData( idBitMsg &out, const idBitMsg &msg ) {
368 int reliableAcknowledge, reliableMessageSize, reliableSequence;
369
370 // read message size
371 out.SetSize( msg.ReadShort() );
372
373 // decompress message
374 idFile_BitMsg file( msg );
375 compressor->Init( &file, false, 3 );
376 compressor->Read( out.GetData(), out.GetSize() );
377 incomingCompression = compressor->GetCompressionRatio();
378 out.BeginReading();
379
380 // read acknowledgement of sent reliable messages
381 reliableAcknowledge = out.ReadInt();
382
383 // remove acknowledged reliable messages
384 while( reliableSend.GetFirst() <= reliableAcknowledge ) {
385 if ( !reliableSend.Get( NULL, reliableMessageSize ) ) {
386 break;
387 }
388 }
389
390 // read reliable messages
391 reliableMessageSize = out.ReadShort();
392 while( reliableMessageSize != 0 ) {
393 if ( reliableMessageSize <= 0 || reliableMessageSize > out.GetSize() - out.GetReadCount() ) {
394 common->Printf( "%s: bad reliable message\n", Sys_NetAdrToString( remoteAddress ) );
395 return false;
396 }
397 reliableSequence = out.ReadInt();
398 if ( reliableSequence == reliableReceive.GetLast() + 1 ) {
399 reliableReceive.Add( out.GetData() + out.GetReadCount(), reliableMessageSize );
400 }
401 out.ReadData( NULL, reliableMessageSize );
402 reliableMessageSize = out.ReadShort();
403 }
404
405 return true;
406}
407
408/*
409=================

Callers

nothing calls this directly

Calls 15

GetCompressionRatioMethod · 0.80
BeginReadingMethod · 0.80
GetFirstMethod · 0.80
GetLastMethod · 0.80
Sys_NetAdrToStringFunction · 0.50
SetSizeMethod · 0.45
ReadShortMethod · 0.45
InitMethod · 0.45
ReadMethod · 0.45
GetDataMethod · 0.45
GetSizeMethod · 0.45
ReadIntMethod · 0.45

Tested by

no test coverage detected