mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +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,
|
||||
HandshakeWelcome,
|
||||
HandshakeProtocolMismatch,
|
||||
HandshakeNotAvailable
|
||||
HandshakeNotAvailable,
|
||||
HandshakeDropped
|
||||
};
|
||||
|
||||
enum { WelcomeMessageProgramNameSize = 64 };
|
||||
|
@ -515,13 +515,19 @@ void View::DrawTextContrast( ImDrawList* draw, const ImVec2& pos, uint32_t color
|
||||
bool View::Draw()
|
||||
{
|
||||
HandshakeStatus status = (HandshakeStatus)s_instance->m_worker.GetHandshakeStatus();
|
||||
if( status == HandshakeProtocolMismatch )
|
||||
switch( status )
|
||||
{
|
||||
case HandshakeProtocolMismatch:
|
||||
ImGui::OpenPopup( "Protocol mismatch" );
|
||||
}
|
||||
else if( status == HandshakeNotAvailable )
|
||||
{
|
||||
break;
|
||||
case HandshakeNotAvailable:
|
||||
ImGui::OpenPopup( "Client not ready" );
|
||||
break;
|
||||
case HandshakeDropped:
|
||||
ImGui::OpenPopup( "Client disconnected" );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const auto& failure = s_instance->m_worker.GetFailureType();
|
||||
@ -562,6 +568,22 @@ bool View::Draw()
|
||||
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 ) )
|
||||
{
|
||||
const auto& data = s_instance->m_worker.GetFailureData();
|
||||
|
@ -1503,7 +1503,11 @@ void Worker::Exec()
|
||||
uint32_t protocolVersion = ProtocolVersion;
|
||||
m_sock.Send( &protocolVersion, sizeof( protocolVersion ) );
|
||||
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 );
|
||||
switch( handshake )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user