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() bool Profiler::HandleServerQuery()
{ {
ServerQueryPacket payload;
if( !m_sock->Read( &payload, sizeof( payload ), 10 ) ) return false;
uint8_t type; uint8_t type;
uint64_t ptr; uint64_t ptr;
uint32_t extra; uint32_t extra;
memcpy( &type, &payload.type, sizeof( payload.type ) );
if( !m_sock->Read( &type, sizeof( type ), 10 ) ) return false; memcpy( &ptr, &payload.ptr, sizeof( payload.ptr ) );
if( !m_sock->Read( &ptr, sizeof( ptr ), 10 ) ) return false; memcpy( &extra, &payload.extra, sizeof( payload.extra ) );
if( !m_sock->Read( &extra, sizeof( extra ), 10 ) ) return false;
switch( type ) switch( type )
{ {