shadow-server: fix state machine
The shadow server was setting up the dynamic channel too quickly, leading
to unexpected packets during the negotiation (unexpected licence packet error
message on the client side). So let's starts dynamic channel once the activation is
done.
@@ -2196,9 +2196,9 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
goto fail;
}
- else
- {
- if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, DRDYNVC_SVC_CHANNEL_NAME))
+
+ if (client->activated &&
+ WTSVirtualChannelManagerIsChannelJoined(client->vcm, DRDYNVC_SVC_CHANNEL_NAME))
{
switch (WTSVirtualChannelManagerGetDrdynvcState(client->vcm))
{
@@ -2215,8 +2215,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
break;
case DRDYNVC_STATE_READY:
- if (client->audin &&
- !IFCALLRESULT(TRUE, client->audin->IsOpen, client->audin))
+ if (client->audin && !IFCALLRESULT(TRUE, client->audin->IsOpen, client->audin))
{
if (!IFCALLRESULT(FALSE, client->audin->Open, client->audin))
{
@@ -2226,11 +2225,9 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
/* Init RDPGFX dynamic channel */
- if (settings->SupportGraphicsPipeline && client->rdpgfx &&
- !gfxstatus.gfxOpened)
+ if (settings->SupportGraphicsPipeline && client->rdpgfx && !gfxstatus.gfxOpened)
{
- client->rdpgfx->FrameAcknowledge =
- shadow_client_rdpgfx_frame_acknowledge;
+ client->rdpgfx->FrameAcknowledge = shadow_client_rdpgfx_frame_acknowledge;
client->rdpgfx->CapsAdvertise = shadow_client_rdpgfx_caps_advertise;
if (!client->rdpgfx->Open(client->rdpgfx))
@@ -2251,7 +2248,6 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
break;
}
}
- }
if (WaitForSingleObject(ChannelEvent, 0) == WAIT_OBJECT_0)
{
