diff options
Diffstat (limited to 'proto-simconnect')
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.cpp | 18 | ||||
-rw-r--r-- | proto-simconnect/ftnoir_protocol_sc.h | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/proto-simconnect/ftnoir_protocol_sc.cpp b/proto-simconnect/ftnoir_protocol_sc.cpp index bd7f0960..580dc257 100644 --- a/proto-simconnect/ftnoir_protocol_sc.cpp +++ b/proto-simconnect/ftnoir_protocol_sc.cpp @@ -42,12 +42,12 @@ void simconnect::run() } Timer tm; - should_reconnect = false; + reconnect = false; if (SUCCEEDED(hr)) while (!isInterruptionRequested()) { - if (should_reconnect) + if (reconnect) break; if (WaitForSingleObject(event, 100) == WAIT_OBJECT_0) @@ -60,17 +60,17 @@ void simconnect::run() break; } } + + if (reconnect) + break; + else { - const int idle_seconds = tm.elapsed_seconds(); - + const int idle_seconds = (int)tm.elapsed_seconds(); constexpr int max_idle_seconds = 2; if (idle_seconds >= max_idle_seconds) - { - qDebug() << "simconnect: reconnect"; break; - } } } @@ -203,11 +203,11 @@ void CALLBACK simconnect::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWO break; case SIMCONNECT_RECV_ID_EXCEPTION: qDebug() << "simconnect: got exception"; - //self.should_reconnect = true; + //self.reconnect = true; break; case SIMCONNECT_RECV_ID_QUIT: qDebug() << "simconnect: got quit event"; - self.should_reconnect = true; + self.reconnect = true; break; case SIMCONNECT_RECV_ID_EVENT_FRAME: self.handle(); diff --git a/proto-simconnect/ftnoir_protocol_sc.h b/proto-simconnect/ftnoir_protocol_sc.h index 9a504ec6..03f27917 100644 --- a/proto-simconnect/ftnoir_protocol_sc.h +++ b/proto-simconnect/ftnoir_protocol_sc.h @@ -87,7 +87,7 @@ private: importSimConnect_SubscribeToSystemEvent simconnect_subscribetosystemevent; HANDLE hSimConnect = nullptr; - std::atomic<bool> should_reconnect = false; + std::atomic<bool> reconnect = false; static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); settings s; QLibrary SCClientLib; |