mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] fix host wait logic and print more useful help
This commit is contained in:
parent
fc0dbd8782
commit
18cc8d7cab
@ -1448,21 +1448,46 @@ static int lg_run()
|
|||||||
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
lgWaitEvent(e_startup, TIMEOUT_INFINITE);
|
||||||
|
|
||||||
LGMP_STATUS status;
|
LGMP_STATUS status;
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
uint32_t udataSize;
|
uint32_t udataSize;
|
||||||
KVMFR *udata;
|
KVMFR *udata;
|
||||||
|
int waitCount = 0;
|
||||||
|
|
||||||
|
while(state.running)
|
||||||
|
{
|
||||||
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp,
|
if ((status = lgmpClientInit(state.shm.mem, state.shm.size, &state.lgmp,
|
||||||
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
|
&udataSize, (uint8_t **)&udata)) == LGMP_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
|
if (status == LGMP_ERR_INVALID_SESSION || status == LGMP_ERR_INVALID_MAGIC)
|
||||||
{
|
{
|
||||||
|
if (waitCount++ == 0)
|
||||||
|
{
|
||||||
|
DEBUG_BREAK();
|
||||||
|
DEBUG_INFO("The host application seems to not be running");
|
||||||
|
DEBUG_INFO("Waiting for the host application to start...");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (waitCount == 30)
|
||||||
|
{
|
||||||
|
DEBUG_BREAK();
|
||||||
|
DEBUG_INFO("Please check the host application is running and is the correct version");
|
||||||
|
DEBUG_INFO("Check the host log in your guest at %%TEMP%%\\looking-glass-host.txt");
|
||||||
|
DEBUG_INFO("Continuing to wait...");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == LGMP_ERR_INVALID_SESSION)
|
||||||
SDL_WaitEventTimeout(NULL, 1000);
|
SDL_WaitEventTimeout(NULL, 1000);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!state.running)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (udataSize != sizeof(KVMFR) ||
|
if (udataSize != sizeof(KVMFR) ||
|
||||||
memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) != 0 ||
|
memcmp(udata->magic, KVMFR_MAGIC, sizeof(udata->magic)) != 0 ||
|
||||||
udata->version != KVMFR_VERSION)
|
udata->version != KVMFR_VERSION)
|
||||||
@ -1475,13 +1500,6 @@ static int lg_run()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_ERROR("lgmpClientInit Failed: %s", lgmpStatusString(status));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!state.running)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
DEBUG_INFO("Host ready, starting session");
|
DEBUG_INFO("Host ready, starting session");
|
||||||
|
|
||||||
if (!lgCreateThread("cursorThread", cursorThread, NULL, &t_cursor))
|
if (!lgCreateThread("cursorThread", cursorThread, NULL, &t_cursor))
|
||||||
@ -1496,7 +1514,6 @@ static int lg_run()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool *closeAlert = NULL;
|
|
||||||
while(state.running)
|
while(state.running)
|
||||||
{
|
{
|
||||||
SDL_WaitEventTimeout(NULL, 1000);
|
SDL_WaitEventTimeout(NULL, 1000);
|
||||||
@ -1506,31 +1523,6 @@ static int lg_run()
|
|||||||
DEBUG_WARN("Session is invalid, has the host shutdown?");
|
DEBUG_WARN("Session is invalid, has the host shutdown?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)closeAlert;
|
|
||||||
/*
|
|
||||||
if (closeAlert == NULL)
|
|
||||||
{
|
|
||||||
if (state.kvmfr->flags & KVMFR_HEADER_FLAG_PAUSED)
|
|
||||||
{
|
|
||||||
if (state.lgr && params.showAlerts)
|
|
||||||
state.lgr->on_alert(
|
|
||||||
state.lgrData,
|
|
||||||
LG_ALERT_WARNING,
|
|
||||||
"Stream Paused",
|
|
||||||
&closeAlert
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!(state.kvmfr->flags & KVMFR_HEADER_FLAG_PAUSED))
|
|
||||||
{
|
|
||||||
*closeAlert = true;
|
|
||||||
closeAlert = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 61c9178c87df46f39a817e63eb85afe2a131e51d
|
Subproject commit 520350a8af533a8ef307da13fa95a19d5ae78762
|
Loading…
Reference in New Issue
Block a user