[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() void CFSDClient::disconnectFromServer()
{ {
this->stopPositionTimers(); this->stopPositionTimers();
if (!m_socket.isOpen()) { return; } this->updateConnectionStatus(CConnectionStatus::Disconnecting);
updateConnectionStatus(CConnectionStatus::Disconnecting);
// allow also to close if broken
if (!m_socket.isOpen())
{
if (m_loginMode.isPilot()) { sendDeletePilot(); } if (m_loginMode.isPilot()) { sendDeletePilot(); }
else if (m_loginMode.isObserver()) { sendDeleteAtc(); } else if (m_loginMode.isObserver()) { sendDeleteAtc(); }
}
m_socket.close(); m_socket.close();
updateConnectionStatus(CConnectionStatus::Disconnected); this->updateConnectionStatus(CConnectionStatus::Disconnected);
this->clearState(); this->clearState();
} }