mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Implement socket read without exit check.
This commit is contained in:
parent
e4ec666479
commit
1bbece649f
@ -2313,17 +2313,15 @@ void Profiler::SendCallstackFrame( uint64_t ptr )
|
||||
}
|
||||
|
||||
|
||||
static bool DontExit() { return false; }
|
||||
|
||||
bool Profiler::HandleServerQuery()
|
||||
{
|
||||
uint8_t type;
|
||||
uint64_t ptr;
|
||||
uint32_t extra;
|
||||
|
||||
if( !m_sock->Read( &type, sizeof( type ), 10, DontExit ) ) return false;
|
||||
if( !m_sock->Read( &ptr, sizeof( ptr ), 10, DontExit ) ) return false;
|
||||
if( !m_sock->Read( &extra, sizeof( extra ), 10, DontExit ) ) return false;
|
||||
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;
|
||||
|
||||
switch( type )
|
||||
{
|
||||
|
@ -221,6 +221,16 @@ int Socket::Recv( void* _buf, int len, int timeout )
|
||||
}
|
||||
}
|
||||
|
||||
bool Socket::Read( void* buf, int len, int timeout )
|
||||
{
|
||||
auto cbuf = (char*)buf;
|
||||
while( len > 0 )
|
||||
{
|
||||
if( !ReadImpl( cbuf, len, timeout ) ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Socket::ReadImpl( char*& buf, int& len, int timeout )
|
||||
{
|
||||
const auto sz = RecvBuffered( buf, len, timeout );
|
||||
|
@ -27,6 +27,8 @@ public:
|
||||
int Send( const void* buf, int len );
|
||||
int GetSendBufSize();
|
||||
|
||||
bool Read( void* buf, int len, int timeout );
|
||||
|
||||
template<typename ShouldExit>
|
||||
bool Read( void* buf, int len, int timeout, ShouldExit exitCb )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user