From b21b6371e3d09551e1cc4d81a0021942dfc064e9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 28 Dec 2018 03:20:23 +0100 Subject: proto/simconnect: crap --- proto-simconnect/ftnoir_protocol_sc.cpp | 18 +++++++++--------- proto-simconnect/ftnoir_protocol_sc.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'proto-simconnect') 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 should_reconnect = false; + std::atomic reconnect = false; static void CALLBACK processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD cbData, void *pContext); settings s; QLibrary SCClientLib; -- cgit v1.2.3