mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Reconnect to client, if requested.
This commit is contained in:
parent
9668234903
commit
3c22134f78
@ -359,6 +359,10 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
static void DrawContents()
|
static void DrawContents()
|
||||||
{
|
{
|
||||||
|
static bool reconnect = false;
|
||||||
|
static std::string reconnectAddr;
|
||||||
|
static int reconnectPort;
|
||||||
|
|
||||||
const ImVec4 clear_color = ImColor( 114, 144, 154 );
|
const ImVec4 clear_color = ImColor( 114, 144, 154 );
|
||||||
|
|
||||||
int display_w, display_h;
|
int display_w, display_h;
|
||||||
@ -660,6 +664,12 @@ static void DrawContents()
|
|||||||
if( !view->Draw() )
|
if( !view->Draw() )
|
||||||
{
|
{
|
||||||
viewShutdown = ViewShutdown::True;
|
viewShutdown = ViewShutdown::True;
|
||||||
|
reconnect = view->ReconnectRequested();
|
||||||
|
if( reconnect )
|
||||||
|
{
|
||||||
|
reconnectAddr = view->GetAddress();
|
||||||
|
reconnectPort = view->GetPort();
|
||||||
|
}
|
||||||
loadThread = std::thread( [view = std::move( view )] () mutable {
|
loadThread = std::thread( [view = std::move( view )] () mutable {
|
||||||
view.reset();
|
view.reset();
|
||||||
viewShutdown = ViewShutdown::Join;
|
viewShutdown = ViewShutdown::Join;
|
||||||
@ -747,6 +757,10 @@ static void DrawContents()
|
|||||||
case ViewShutdown::Join:
|
case ViewShutdown::Join:
|
||||||
loadThread.join();
|
loadThread.join();
|
||||||
viewShutdown = ViewShutdown::False;
|
viewShutdown = ViewShutdown::False;
|
||||||
|
if( reconnect )
|
||||||
|
{
|
||||||
|
view = std::make_unique<tracy::View>( reconnectAddr.c_str(), reconnectPort, fixedWidth, smallFont, bigFont, SetWindowTitleCallback );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user