File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -583,6 +583,10 @@ class WASimClient::Private
583
583
return E_TIMEOUT;
584
584
}
585
585
586
+ // bail out if connection was canceled while waiting
587
+ if (!runDispatchLoop)
588
+ return E_FAIL;
589
+
586
590
// register server's Connect command event, exit on failure
587
591
if FAILED (hr = SimConnectHelper::newClientEvent (hSim, CLI_EVENT_CONNECT, EVENT_NAME_CONNECT)) {
588
592
disconnectSimulator ();
@@ -638,12 +642,15 @@ class WASimClient::Private
638
642
LOG_DBG << " Shutting down..." ;
639
643
disconnectServer (!onQuitEvent);
640
644
setStatus (ClientStatus::ShuttingDown);
641
- SetEvent (hDispatchStopEvent); // signal thread to exit
642
- // d->dispatchThread.join();
643
645
644
- // check for dispatch loop thread shutdown (this is really just for logging/debug purposes)
645
- if (!waitCondition ([&]() { return !runDispatchLoop; }, DISPATCH_LOOP_WAIT_TIME + 100 ))
646
- LOG_CRT << " Dispatch loop thread still running!" ;
646
+ if (!!hDispatchStopEvent) {
647
+ SetEvent (hDispatchStopEvent); // signal thread to exit
648
+ // d->dispatchThread.join();
649
+
650
+ // check for dispatch loop thread shutdown (this is really just for logging/debug purposes)
651
+ if (!waitCondition ([&]() { return !runDispatchLoop; }, DISPATCH_LOOP_WAIT_TIME + 100 ))
652
+ LOG_CRT << " Dispatch loop thread still running!" ;
653
+ }
647
654
648
655
// reset flags/counters
649
656
simConnected = false ;
You can’t perform that action at this time.
0 commit comments