MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / startPingThread

Function startPingThread

src/platform/windows/virtual_display.cpp:588–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588bool startPingThread(std::function<void()> failCb) {
589 if (SUDOVDA_DRIVER_HANDLE == INVALID_HANDLE_VALUE) {
590 return false;
591 }
592
593 VIRTUAL_DISPLAY_GET_WATCHDOG_OUT watchdogOut;
594 if (GetWatchdogTimeout(SUDOVDA_DRIVER_HANDLE, watchdogOut)) {
595 printf("[SUDOVDA] Watchdog: Timeout %d, Countdown %d\n", watchdogOut.Timeout, watchdogOut.Countdown);
596 } else {
597 printf("[SUDOVDA] Watchdog fetch failed!\n");
598 return false;
599 }
600
601 if (watchdogOut.Timeout) {
602 auto sleepInterval = watchdogOut.Timeout * 1000 / 3;
603 std::thread ping_thread([sleepInterval, failCb = std::move(failCb)]{
604 uint8_t fail_count = 0;
605 for (;;) {
606 if (!sleepInterval) return;
607 if (!PingDriver(SUDOVDA_DRIVER_HANDLE)) {
608 fail_count += 1;
609 if (fail_count > 3) {
610 failCb();
611 return;
612 }
613 };
614 Sleep(sleepInterval);
615 }
616 });
617
618 ping_thread.detach();
619 }
620
621 return true;
622}
623
624bool setRenderAdapterByName(const std::wstring& adapterName) {
625 if (SUDOVDA_DRIVER_HANDLE == INVALID_HANDLE_VALUE) {

Callers 1

initVDisplayDriverFunction · 0.85

Calls 3

GetWatchdogTimeoutFunction · 0.85
moveFunction · 0.85
PingDriverFunction · 0.85

Tested by

no test coverage detected