[AFV] Ref T730, allow to disconnect even if socket is down

This commit is contained in:
Klaus Basan
2019-10-21 23:33:39 +02:00
parent 317607f5a5
commit ca60dbfa4d

View File

@@ -222,16 +222,17 @@ namespace BlackCore
void CFSDClient::disconnectFromServer()
{
this->stopPositionTimers();
if (!m_socket.isOpen()) { return; }
updateConnectionStatus(CConnectionStatus::Disconnecting);
if (m_loginMode.isPilot()) { sendDeletePilot(); }
else if (m_loginMode.isObserver()) { sendDeleteAtc(); }
this->updateConnectionStatus(CConnectionStatus::Disconnecting);
// allow also to close if broken
if (!m_socket.isOpen())
{
if (m_loginMode.isPilot()) { sendDeletePilot(); }
else if (m_loginMode.isObserver()) { sendDeleteAtc(); }
}
m_socket.close();
updateConnectionStatus(CConnectionStatus::Disconnected);
this->updateConnectionStatus(CConnectionStatus::Disconnected);
this->clearState();
}