mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Search for free listen port, if default is occupied.
This commit is contained in:
parent
1f3dc927c0
commit
3b85c51e5f
@ -1173,9 +1173,11 @@ void Profiler::Worker()
|
|||||||
SetThreadName( "Tracy Profiler" );
|
SetThreadName( "Tracy Profiler" );
|
||||||
|
|
||||||
#ifdef TRACY_DATA_PORT
|
#ifdef TRACY_DATA_PORT
|
||||||
const auto dataPort = m_userPort != 0 ? m_userPort : TRACY_DATA_PORT;
|
const bool dataPortSearch = false;
|
||||||
|
auto dataPort = m_userPort != 0 ? m_userPort : TRACY_DATA_PORT;
|
||||||
#else
|
#else
|
||||||
const auto dataPort = m_userPort != 0 ? m_userPort : 8086;
|
const bool dataPortSearch = m_userPort == 0;
|
||||||
|
auto dataPort = m_userPort != 0 ? m_userPort : 8086;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRACY_BROADCAST_PORT
|
#ifdef TRACY_BROADCAST_PORT
|
||||||
const auto broadcastPort = TRACY_BROADCAST_PORT;
|
const auto broadcastPort = TRACY_BROADCAST_PORT;
|
||||||
@ -1239,7 +1241,24 @@ void Profiler::Worker()
|
|||||||
moodycamel::ConsumerToken token( GetQueue() );
|
moodycamel::ConsumerToken token( GetQueue() );
|
||||||
|
|
||||||
ListenSocket listen;
|
ListenSocket listen;
|
||||||
if( !listen.Listen( dataPort, 8 ) )
|
bool isListening = false;
|
||||||
|
if( !dataPortSearch )
|
||||||
|
{
|
||||||
|
isListening = listen.Listen( dataPort, 4 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( uint32_t i=0; i<20; i++ )
|
||||||
|
{
|
||||||
|
if( listen.Listen( dataPort+i, 4 ) )
|
||||||
|
{
|
||||||
|
dataPort += i;
|
||||||
|
isListening = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( !isListening )
|
||||||
{
|
{
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user