mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 07:01:30 +00:00
[client] spice: gate USB reconnect on MAIN health
This commit is contained in:
@@ -55,6 +55,8 @@ struct LG_USBRedir
|
|||||||
bool disconnectPending;
|
bool disconnectPending;
|
||||||
int64_t disconnectDeadline;
|
int64_t disconnectDeadline;
|
||||||
int64_t reconnectDeadline;
|
int64_t reconnectDeadline;
|
||||||
|
uint64_t mainPingCount;
|
||||||
|
bool waitingForMainPing;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void setAvailable(LG_USBRedir * usbredir, bool available)
|
static void setAvailable(LG_USBRedir * usbredir, bool available)
|
||||||
@@ -192,6 +194,25 @@ static bool selectChannel(LG_USBRedir * usbredir)
|
|||||||
if (usbredir->channel)
|
if (usbredir->channel)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (!purespice_channelConnected(PS_CHANNEL_MAIN))
|
||||||
|
{
|
||||||
|
usbredir->reconnectDeadline =
|
||||||
|
(int64_t)nanotime() + USB_REDIR_RECONNECT_DELAY_NS;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (usbredir->waitingForMainPing)
|
||||||
|
{
|
||||||
|
if (purespice_mainPingCount() == usbredir->mainPingCount)
|
||||||
|
{
|
||||||
|
usbredir->reconnectDeadline =
|
||||||
|
(int64_t)nanotime() + USB_REDIR_RECONNECT_DELAY_NS;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
usbredir->waitingForMainPing = false;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < USB_REDIR_CHANNEL_COUNT; ++i)
|
for (unsigned int i = 0; i < USB_REDIR_CHANNEL_COUNT; ++i)
|
||||||
{
|
{
|
||||||
PSUSBRedirChannel * channel = usbredir->channels[i];
|
PSUSBRedirChannel * channel = usbredir->channels[i];
|
||||||
@@ -424,9 +445,17 @@ void lgUsbRedir_state(PSUSBRedirChannel * channel,
|
|||||||
destroyParser(usbredir);
|
destroyParser(usbredir);
|
||||||
usbredir->channel = NULL;
|
usbredir->channel = NULL;
|
||||||
if (purespice_usbRedirAvailable(channel))
|
if (purespice_usbRedirAvailable(channel))
|
||||||
|
{
|
||||||
|
/* Wait for a fresh MAIN PING/PONG before reconnecting this
|
||||||
|
* optional channel. The server shuts it down before MAIN during a
|
||||||
|
* session teardown, so this prevents reconnect attempts to a
|
||||||
|
* disappearing SPICE server. */
|
||||||
|
usbredir->mainPingCount = purespice_mainPingCount();
|
||||||
|
usbredir->waitingForMainPing = true;
|
||||||
usbredir->reconnectDeadline =
|
usbredir->reconnectDeadline =
|
||||||
(int64_t)nanotime() + USB_REDIR_RECONNECT_DELAY_NS;
|
(int64_t)nanotime() + USB_REDIR_RECONNECT_DELAY_NS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PS_USB_REDIR_UNAVAILABLE:
|
case PS_USB_REDIR_UNAVAILABLE:
|
||||||
|
|||||||
Submodule repos/PureSpice updated: 1c0b08204b...e324456ab5
Reference in New Issue
Block a user