Permalink
Browse files

Remove unused field: blockData. It could waste up to 256 KB per client.

  • Loading branch information...
geneotech committed Dec 8, 2018
1 parent 06db090 commit ffec5ec37434f92dc721ea6469a0de3e50153881
Showing with 2 additions and 6 deletions.
  1. +1 −1 yojimbo.cpp
  2. +1 −5 yojimbo.h
@@ -1586,7 +1586,7 @@ namespace yojimbo

if ( !config.disableBlocks )
{
m_sendBlock = YOJIMBO_NEW( *m_allocator, SendBlockData, *m_allocator, m_config.maxBlockSize, m_config.GetMaxFragmentsPerBlock() );
m_sendBlock = YOJIMBO_NEW( *m_allocator, SendBlockData, *m_allocator, m_config.GetMaxFragmentsPerBlock() );
m_receiveBlock = YOJIMBO_NEW( *m_allocator, ReceiveBlockData, *m_allocator, m_config.maxBlockSize, m_config.GetMaxFragmentsPerBlock() );
}
else
@@ -4462,22 +4462,19 @@ namespace yojimbo

struct SendBlockData
{
SendBlockData( Allocator & allocator, int maxBlockSize, int maxFragmentsPerBlock )
SendBlockData( Allocator & allocator, int maxFragmentsPerBlock )
{
m_allocator = &allocator;
ackedFragment = YOJIMBO_NEW( allocator, BitArray, allocator, maxFragmentsPerBlock );
fragmentSendTime = (double*) YOJIMBO_ALLOCATE( allocator, sizeof( double) * maxFragmentsPerBlock );
blockData = (uint8_t*) YOJIMBO_ALLOCATE( allocator, maxBlockSize );
yojimbo_assert( ackedFragment );
yojimbo_assert( fragmentSendTime );
yojimbo_assert( blockData );
Reset();
}

~SendBlockData()
{
YOJIMBO_DELETE( *m_allocator, BitArray, ackedFragment );
YOJIMBO_FREE( *m_allocator, blockData );
YOJIMBO_FREE( *m_allocator, fragmentSendTime );
}

@@ -4497,7 +4494,6 @@ namespace yojimbo
uint16_t blockMessageId; ///< The message id the block is attached to.
BitArray * ackedFragment; ///< Has fragment n been received?
double * fragmentSendTime; ///< Last time fragment was sent.
uint8_t * blockData; ///< The block data.

private:

0 comments on commit ffec5ec

Please sign in to comment.