mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Handle dropped connection during handshake.
This commit is contained in:
parent
8717fe5730
commit
7f11260bf0
@ -37,7 +37,8 @@ enum HandshakeStatus : uint8_t
|
|||||||
HandshakePending,
|
HandshakePending,
|
||||||
HandshakeWelcome,
|
HandshakeWelcome,
|
||||||
HandshakeProtocolMismatch,
|
HandshakeProtocolMismatch,
|
||||||
HandshakeNotAvailable
|
HandshakeNotAvailable,
|
||||||
|
HandshakeDropped
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { WelcomeMessageProgramNameSize = 64 };
|
enum { WelcomeMessageProgramNameSize = 64 };
|
||||||
|
@ -515,13 +515,19 @@ void View::DrawTextContrast( ImDrawList* draw, const ImVec2& pos, uint32_t color
|
|||||||
bool View::Draw()
|
bool View::Draw()
|
||||||
{
|
{
|
||||||
HandshakeStatus status = (HandshakeStatus)s_instance->m_worker.GetHandshakeStatus();
|
HandshakeStatus status = (HandshakeStatus)s_instance->m_worker.GetHandshakeStatus();
|
||||||
if( status == HandshakeProtocolMismatch )
|
switch( status )
|
||||||
{
|
{
|
||||||
|
case HandshakeProtocolMismatch:
|
||||||
ImGui::OpenPopup( "Protocol mismatch" );
|
ImGui::OpenPopup( "Protocol mismatch" );
|
||||||
}
|
break;
|
||||||
else if( status == HandshakeNotAvailable )
|
case HandshakeNotAvailable:
|
||||||
{
|
|
||||||
ImGui::OpenPopup( "Client not ready" );
|
ImGui::OpenPopup( "Client not ready" );
|
||||||
|
break;
|
||||||
|
case HandshakeDropped:
|
||||||
|
ImGui::OpenPopup( "Client disconnected" );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& failure = s_instance->m_worker.GetFailureType();
|
const auto& failure = s_instance->m_worker.GetFailureType();
|
||||||
@ -562,6 +568,22 @@ bool View::Draw()
|
|||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ImGui::BeginPopupModal( "Client disconnected", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||||
|
{
|
||||||
|
#ifdef TRACY_EXTENDED_FONT
|
||||||
|
TextCentered( ICON_FA_HANDSHAKE );
|
||||||
|
#endif
|
||||||
|
ImGui::TextUnformatted( "The client you are trying to connect to has disconnected during the initial\nconnection handshake. Please check your network configuration." );
|
||||||
|
ImGui::Separator();
|
||||||
|
if( ImGui::Button( "Will do" ) )
|
||||||
|
{
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
ImGui::EndPopup();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
|
||||||
if( ImGui::BeginPopupModal( "Instrumentation failure", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
if( ImGui::BeginPopupModal( "Instrumentation failure", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||||
{
|
{
|
||||||
const auto& data = s_instance->m_worker.GetFailureData();
|
const auto& data = s_instance->m_worker.GetFailureData();
|
||||||
|
@ -1503,7 +1503,11 @@ void Worker::Exec()
|
|||||||
uint32_t protocolVersion = ProtocolVersion;
|
uint32_t protocolVersion = ProtocolVersion;
|
||||||
m_sock.Send( &protocolVersion, sizeof( protocolVersion ) );
|
m_sock.Send( &protocolVersion, sizeof( protocolVersion ) );
|
||||||
HandshakeStatus handshake;
|
HandshakeStatus handshake;
|
||||||
if( !m_sock.Read( &handshake, sizeof( handshake ), 10, ShouldExit ) ) goto close;
|
if( !m_sock.Read( &handshake, sizeof( handshake ), 10, ShouldExit ) )
|
||||||
|
{
|
||||||
|
m_handshake.store( HandshakeDropped, std::memory_order_relaxed );
|
||||||
|
goto close;
|
||||||
|
}
|
||||||
m_handshake.store( handshake, std::memory_order_relaxed );
|
m_handshake.store( handshake, std::memory_order_relaxed );
|
||||||
switch( handshake )
|
switch( handshake )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user