diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-28 03:20:23 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-01-16 07:48:18 +0100 |
commit | b21b6371e3d09551e1cc4d81a0021942dfc064e9 (patch) | |
tree | b153ac24f84c51c5d0393f9ee80a6b16e00ed8c4 /proto-simconnect | |
parent | 70048a925a7e34e1307c7ca501671f0bd75ec817 (diff) |
proto/simconnect: crap
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; |