mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-22 07:01:30 +00:00
[client] spice: add fail-fast connection option
This commit is contained in:
@@ -325,10 +325,7 @@ int spiceSession_thread(void * opaque)
|
||||
|
||||
PSStatus status = PS_STATUS_SHUTDOWN;
|
||||
if (!purespice_connect(&config))
|
||||
{
|
||||
DEBUG_ERROR("Failed to connect to SPICE server");
|
||||
goto done;
|
||||
}
|
||||
|
||||
transport->connected = true;
|
||||
status = PS_STATUS_RUN;
|
||||
|
||||
@@ -62,6 +62,13 @@ static void spiceSetup(void)
|
||||
.type = OPTION_TYPE_INT,
|
||||
.value.x_int = 5900
|
||||
},
|
||||
{
|
||||
.module = "spice",
|
||||
.name = "waitForServer",
|
||||
.description = "Wait for the SPICE server to become available",
|
||||
.type = OPTION_TYPE_BOOL,
|
||||
.value.x_bool = true
|
||||
},
|
||||
{
|
||||
.module = "spice",
|
||||
.name = "input",
|
||||
@@ -127,6 +134,7 @@ static bool spiceCreate(LG_Transport ** result)
|
||||
transport->usbAudioEnabled =
|
||||
option_get_bool("spice", "usbAudio");
|
||||
transport->audioDebug = option_get_bool("audio", "debug");
|
||||
transport->waitForServer = option_get_bool("spice", "waitForServer");
|
||||
|
||||
#if !ENABLE_USB_AUDIO
|
||||
if (transport->audioEnabled && transport->usbAudioEnabled)
|
||||
@@ -265,9 +273,12 @@ static LG_TransportStatus spiceConnectCancellable(LG_Transport * transport,
|
||||
|
||||
if (transport->connectStatus != LG_TRANSPORT_OK)
|
||||
{
|
||||
const LG_TransportStatus status = transport->connectStatus;
|
||||
lgJoinThread(transport->thread, NULL);
|
||||
transport->thread = NULL;
|
||||
return transport->connectStatus;
|
||||
if (status == LG_TRANSPORT_ERROR && transport->waitForServer)
|
||||
return LG_TRANSPORT_UNAVAILABLE;
|
||||
return status;
|
||||
}
|
||||
|
||||
*session = transport->session;
|
||||
|
||||
@@ -51,6 +51,7 @@ struct LG_Transport
|
||||
bool playbackEnabled;
|
||||
bool recordEnabled;
|
||||
bool audioDebug;
|
||||
bool waitForServer;
|
||||
|
||||
SpiceInput * input;
|
||||
SpiceClipboard * clipboard;
|
||||
|
||||
Reference in New Issue
Block a user