mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Require shibboleth match at start of connection.
This commit is contained in:
parent
f55f2858c4
commit
270072b09e
@ -913,6 +913,21 @@ void Profiler::Worker()
|
||||
if( m_sock ) break;
|
||||
}
|
||||
|
||||
{
|
||||
timeval tv;
|
||||
tv.tv_sec = 2;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
char shibboleth[HandshakeShibbolethSize];
|
||||
const auto res = m_sock->ReadRaw( shibboleth, HandshakeShibbolethSize, &tv );
|
||||
if( !res || memcmp( shibboleth, HandshakeShibboleth, HandshakeShibbolethSize ) != 0 )
|
||||
{
|
||||
m_sock->~Socket();
|
||||
tracy_free( m_sock );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TRACY_ON_DEMAND
|
||||
ClearQueues( token );
|
||||
m_isConnected.store( true, std::memory_order_relaxed );
|
||||
|
@ -27,6 +27,9 @@ enum ServerQuery : uint8_t
|
||||
ServerQueryFrameName,
|
||||
};
|
||||
|
||||
enum { HandshakeShibbolethSize = 8 };
|
||||
static const char HandshakeShibboleth[HandshakeShibbolethSize] = { 'T', 'r', 'a', 'c', 'y', 'P', 'r', 'f' };
|
||||
|
||||
enum { WelcomeMessageProgramNameSize = 64 };
|
||||
enum { WelcomeMessageHostInfoSize = 1024 };
|
||||
|
||||
|
@ -1279,6 +1279,8 @@ void Worker::Exec()
|
||||
if( m_sock.Connect( m_addr.c_str(), "8086" ) ) break;
|
||||
}
|
||||
|
||||
m_sock.Send( HandshakeShibboleth, HandshakeShibbolethSize );
|
||||
|
||||
auto lz4buf = std::make_unique<char[]>( LZ4Size );
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> t0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user