mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Raw socket read function.
This commit is contained in:
parent
806c8de463
commit
f55f2858c4
@ -229,6 +229,19 @@ bool Socket::Read( void* _buf, int len, const timeval* tv, std::function<bool()>
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Socket::ReadRaw( void* _buf, int len, const timeval* tv )
|
||||
{
|
||||
auto buf = (char*)_buf;
|
||||
while( len > 0 )
|
||||
{
|
||||
const auto sz = Recv( buf, len, tv );
|
||||
if( sz <= 0 ) return false;
|
||||
len -= sz;
|
||||
buf += sz;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Socket::HasData()
|
||||
{
|
||||
if( m_bufLeft > 0 ) return true;
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
int Send( const void* buf, int len );
|
||||
|
||||
bool Read( void* buf, int len, const timeval* tv, std::function<bool()> exitCb );
|
||||
bool ReadRaw( void* buf, int len, const timeval* tv );
|
||||
bool HasData();
|
||||
|
||||
Socket( const Socket& ) = delete;
|
||||
|
Loading…
Reference in New Issue
Block a user