mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Socket::ReadUpTo() doesn't support timeouts.
This commit is contained in:
parent
72dfab80f8
commit
778d0cb3fb
@ -80,7 +80,7 @@ void HttpRequest( const char* server, const char* resource, int port, std::funct
|
|||||||
const auto len = sprintf( request, "GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: Tracy Profiler %i.%i.%i (%s)\r\nConnection: close\r\nCache-Control: no-cache, no-store, must-revalidate\r\n\r\n", resource, server, tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch, GetOsInfo() );
|
const auto len = sprintf( request, "GET %s HTTP/1.1\r\nHost: %s\r\nUser-Agent: Tracy Profiler %i.%i.%i (%s)\r\nConnection: close\r\nCache-Control: no-cache, no-store, must-revalidate\r\n\r\n", resource, server, tracy::Version::Major, tracy::Version::Minor, tracy::Version::Patch, GetOsInfo() );
|
||||||
sock.Send( request, len );
|
sock.Send( request, len );
|
||||||
char response[4096];
|
char response[4096];
|
||||||
const auto sz = sock.ReadUpTo( response, 4096, 15 );
|
const auto sz = sock.ReadUpTo( response, 4096 );
|
||||||
if( sz < 13 ) return;
|
if( sz < 13 ) return;
|
||||||
if( memcmp( response, "HTTP/1.1 200", 12 ) != 0 ) return;
|
if( memcmp( response, "HTTP/1.1 200", 12 ) != 0 ) return;
|
||||||
auto hdr = response + 13;
|
auto hdr = response + 13;
|
||||||
|
@ -353,7 +353,7 @@ int Socket::Recv( void* _buf, int len, int timeout )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Socket::ReadUpTo( void* _buf, int len, int timeout )
|
int Socket::ReadUpTo( void* _buf, int len )
|
||||||
{
|
{
|
||||||
const auto sock = m_sock.load( std::memory_order_relaxed );
|
const auto sock = m_sock.load( std::memory_order_relaxed );
|
||||||
auto buf = (char*)_buf;
|
auto buf = (char*)_buf;
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
int Send( const void* buf, int len );
|
int Send( const void* buf, int len );
|
||||||
int GetSendBufSize();
|
int GetSendBufSize();
|
||||||
|
|
||||||
int ReadUpTo( void* buf, int len, int timeout );
|
int ReadUpTo( void* buf, int len );
|
||||||
bool Read( void* buf, int len, int timeout );
|
bool Read( void* buf, int len, int timeout );
|
||||||
|
|
||||||
template<typename ShouldExit>
|
template<typename ShouldExit>
|
||||||
|
Loading…
Reference in New Issue
Block a user