mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[host] added clean guest restart mechanisim
This commit is contained in:
parent
edecd922ea
commit
fc49c10ea6
@ -81,17 +81,17 @@ bool Service::Initialize(ICapture * captureDevice)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we save this as it might actually be valid
|
// update everything except for the hostID
|
||||||
UINT16 hostID = m_header->hostID;
|
|
||||||
|
|
||||||
ZeroMemory(m_header, sizeof(KVMFRHeader));
|
|
||||||
memcpy(m_header->magic, KVMFR_HEADER_MAGIC, sizeof(KVMFR_HEADER_MAGIC));
|
memcpy(m_header->magic, KVMFR_HEADER_MAGIC, sizeof(KVMFR_HEADER_MAGIC));
|
||||||
|
|
||||||
m_header->version = KVMFR_HEADER_VERSION;
|
m_header->version = KVMFR_HEADER_VERSION;
|
||||||
m_header->guestID = m_ivshmem->GetPeerID();
|
m_header->guestID = m_ivshmem->GetPeerID();
|
||||||
m_header->hostID = hostID;
|
|
||||||
m_header->updateCount = 0;
|
m_header->updateCount = 0;
|
||||||
|
|
||||||
|
// clear but retain the restart flag if it was set by the client
|
||||||
|
InterlockedAnd8((char *)&m_header->flags, KVMFR_HEADER_FLAG_RESTART);
|
||||||
|
ZeroMemory(&m_header->frame , sizeof(KVMFRFrame ));
|
||||||
|
ZeroMemory(&m_header->cursor, sizeof(KVMFRCursor));
|
||||||
|
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -155,6 +155,13 @@ bool Service::Process()
|
|||||||
bool eventDone = false;
|
bool eventDone = false;
|
||||||
while (!eventDone)
|
while (!eventDone)
|
||||||
{
|
{
|
||||||
|
// check if the client has flagged a restart
|
||||||
|
if (m_header->flags & KVMFR_HEADER_FLAG_RESTART)
|
||||||
|
{
|
||||||
|
InterlockedAnd8((char *)&m_header->flags, ~(KVMFR_HEADER_FLAG_RESTART));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (WaitForSingleObject(m_readyEvent, 1000))
|
switch (WaitForSingleObject(m_readyEvent, 1000))
|
||||||
{
|
{
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
|
Loading…
Reference in New Issue
Block a user