mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Always disconnect CNetworkVatlib when shutting down.
This commit is contained in:
@@ -216,16 +216,12 @@ namespace BlackCore
|
|||||||
CStatusMessage CContextNetwork::disconnectFromNetwork()
|
CStatusMessage CContextNetwork::disconnectFromNetwork()
|
||||||
{
|
{
|
||||||
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||||
if (this->m_network->isConnected())
|
if (this->m_network->isConnected() || this->m_network->isPendingConnection())
|
||||||
{
|
{
|
||||||
this->m_currentStatus = INetwork::Disconnecting; // as semaphore we are going to disconnect
|
this->m_currentStatus = INetwork::Disconnecting; // as semaphore we are going to disconnect
|
||||||
this->m_network->terminateConnection();
|
this->m_network->terminateConnection();
|
||||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, "Connection terminating");
|
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, "Connection terminating");
|
||||||
}
|
}
|
||||||
else if (this->isPendingConnection())
|
|
||||||
{
|
|
||||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, "Pending connection, please wait");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityWarning, "Already disconnected");
|
return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityWarning, "Already disconnected");
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include "blackmisc/logmessage.h"
|
#include "blackmisc/logmessage.h"
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/statusmessage.h"
|
#include "blackmisc/statusmessage.h"
|
||||||
|
#include "blackmisc/verify.h"
|
||||||
#include "vatlib/vatlib.h"
|
#include "vatlib/vatlib.h"
|
||||||
|
|
||||||
#include <QChar>
|
#include <QChar>
|
||||||
@@ -157,7 +158,8 @@ namespace BlackCore
|
|||||||
|
|
||||||
CNetworkVatlib::~CNetworkVatlib()
|
CNetworkVatlib::~CNetworkVatlib()
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(isDisconnected(), Q_FUNC_INFO, "CNetworkVatlib destroyed while still connected.");
|
BLACK_VERIFY_X(isDisconnected(), Q_FUNC_INFO, "CNetworkVatlib destroyed while still connected.");
|
||||||
|
terminateConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNetworkVatlib::process()
|
void CNetworkVatlib::process()
|
||||||
@@ -466,7 +468,7 @@ namespace BlackCore
|
|||||||
void CNetworkVatlib::terminateConnection()
|
void CNetworkVatlib::terminateConnection()
|
||||||
{
|
{
|
||||||
stopPositionTimers();
|
stopPositionTimers();
|
||||||
if (m_net && isConnected())
|
if (m_net && !isDisconnected())
|
||||||
{
|
{
|
||||||
// Process all pending tasks before logging off
|
// Process all pending tasks before logging off
|
||||||
process();
|
process();
|
||||||
|
|||||||
Reference in New Issue
Block a user