1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Allow specifying network port in server.

This commit is contained in:
Bartosz Taudul
2019-09-21 15:43:01 +02:00
parent fb63dd89bc
commit 82cd667b30
10 changed files with 58 additions and 23 deletions
+2 -2
View File
@@ -110,8 +110,8 @@ enum { MinFrameSize = 5 };
static View* s_instance = nullptr;
View::View( const char* addr, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb )
: m_worker( addr )
View::View( const char* addr, int port, ImFont* fixedWidth, ImFont* smallFont, ImFont* bigFont, SetTitleCallback stcb )
: m_worker( addr, port )
, m_staticView( false )
, m_pause( false )
, m_frames( nullptr )
+2 -2
View File
@@ -63,8 +63,8 @@ public:
using SetTitleCallback = void(*)( const char* );
View( ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr ) : View( "127.0.0.1", fixedWidth, smallFont, bigFont, stcb ) {}
View( const char* addr, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
View( ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr ) : View( "127.0.0.1", 8086, fixedWidth, smallFont, bigFont, stcb ) {}
View( const char* addr, int port, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
View( FileRead& f, ImFont* fixedWidth = nullptr, ImFont* smallFont = nullptr, ImFont* bigFont = nullptr, SetTitleCallback stcb = nullptr );
~View();
+3 -2
View File
@@ -234,8 +234,9 @@ static tracy_force_inline void UpdateLockRange( LockMap& lockmap, const LockEven
LoadProgress Worker::s_loadProgress;
Worker::Worker( const char* addr )
Worker::Worker( const char* addr, int port )
: m_addr( addr )
, m_port( port )
, m_hasData( false )
, m_stream( LZ4_createStreamDecode() )
, m_buffer( new char[TargetFrameSize*3 + 1] )
@@ -2125,7 +2126,7 @@ void Worker::Exec()
for(;;)
{
if( m_shutdown.load( std::memory_order_relaxed ) ) return;
if( m_sock.Connect( m_addr.c_str(), "8086" ) ) break;
if( m_sock.Connect( m_addr.c_str(), m_port ) ) break;
}
auto lz4buf = std::make_unique<char[]>( LZ4Size );
+2 -1
View File
@@ -270,7 +270,7 @@ public:
NUM_FAILURES
};
Worker( const char* addr );
Worker( const char* addr, int port );
Worker( FileRead& f, EventType::Type eventMask = EventType::All );
~Worker();
@@ -536,6 +536,7 @@ private:
Socket m_sock;
std::string m_addr;
int m_port;
std::thread m_thread;
std::atomic<bool> m_connected { false };