Issue just one read call when handling server queries.

This commit is contained in:
Bartosz Taudul 2020-04-13 14:26:59 +02:00
parent 1bbece649f
commit b389ccbb38

View File

@ -2315,13 +2315,15 @@ void Profiler::SendCallstackFrame( uint64_t ptr )
bool Profiler::HandleServerQuery()
{
ServerQueryPacket payload;
if( !m_sock->Read( &payload, sizeof( payload ), 10 ) ) return false;
uint8_t type;
uint64_t ptr;
uint32_t extra;
if( !m_sock->Read( &type, sizeof( type ), 10 ) ) return false;
if( !m_sock->Read( &ptr, sizeof( ptr ), 10 ) ) return false;
if( !m_sock->Read( &extra, sizeof( extra ), 10 ) ) return false;
memcpy( &type, &payload.type, sizeof( payload.type ) );
memcpy( &ptr, &payload.ptr, sizeof( payload.ptr ) );
memcpy( &extra, &payload.extra, sizeof( payload.extra ) );
switch( type )
{