cleanup internal structures as soon as the controller is disconnected
This commit is contained in:
@@ -56,6 +56,7 @@ PlugIn::PlugIn() :
|
||||
m_inbounds(),
|
||||
m_forcedToBackendCallsigns(),
|
||||
m_compatible(false),
|
||||
m_connectedToNetwork(false),
|
||||
m_sweatboxValid(false),
|
||||
m_playbackValid(false) {
|
||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||
@@ -655,6 +656,22 @@ void PlugIn::updateSequence(std::shared_ptr<aman::AircraftSequence>& sequence) {
|
||||
}
|
||||
|
||||
void PlugIn::OnTimer(int counter) {
|
||||
/* cleanup the internal data */
|
||||
if (EuroScopePlugIn::CONNECTION_TYPE_NO == this->GetConnectionType()) {
|
||||
if (true == this->m_connectedToNetwork) {
|
||||
std::lock_guard guardUpdate(this->m_updateQueueLock);
|
||||
this->m_updateQueue.clear();
|
||||
|
||||
std::lock_guard guardInbound(this->m_inboundsQueueLock);
|
||||
this->m_inbounds.clear();
|
||||
|
||||
this->m_connectedToNetwork = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this->m_connectedToNetwork = true;
|
||||
if (false == this->m_compatible || false == Backend::instance().initialized() || 0 != (counter % 10))
|
||||
return;
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace aman {
|
||||
std::map<std::string, Inbound> m_inbounds;
|
||||
std::list<std::string> m_forcedToBackendCallsigns;
|
||||
bool m_compatible;
|
||||
bool m_connectedToNetwork;
|
||||
bool m_sweatboxValid;
|
||||
bool m_playbackValid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user