server: proxy: fix sync issue in gfx opening

This commit is contained in:
kubistika 2019-11-12 10:42:28 +02:00 committed by akallabeth
parent 8cf19fd94e
commit 09648834a0
4 changed files with 19 additions and 2 deletions

View File

@ -65,6 +65,8 @@ void pf_OnChannelConnectedEventHandler(void* data, ChannelConnectedEventArgs* e)
else if (strcmp(e->name, RDPGFX_DVC_CHANNEL_NAME) == 0)
{
pf_channels_wait_for_server_dynvc(ps);
pc->gfx_proxy = (RdpgfxClientContext*)e->pInterface;
pf_rdpgfx_pipeline_init(pc->gfx_proxy, ps->gfx, pc->pdata);
if (!ps->gfx->Open(ps->gfx))
{
@ -72,8 +74,7 @@ void pf_OnChannelConnectedEventHandler(void* data, ChannelConnectedEventArgs* e)
return;
}
pc->gfx_proxy = (RdpgfxClientContext*)e->pInterface;
pf_rdpgfx_pipeline_init(pc->gfx_proxy, ps->gfx, pc->pdata);
SetEvent(pc->pdata->gfx_server_ready);
}
else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
{

View File

@ -173,6 +173,12 @@ proxyData* proxy_data_new(void)
return NULL;
}
if (!(pdata->gfx_server_ready = CreateEvent(NULL, TRUE, FALSE, NULL)))
{
proxy_data_free(pdata);
return NULL;
}
return pdata;
}
@ -190,6 +196,12 @@ void proxy_data_free(proxyData* pdata)
pdata->client_thread = NULL;
}
if (pdata->gfx_server_ready)
{
CloseHandle(pdata->gfx_server_ready);
pdata->gfx_server_ready = NULL;
}
free(pdata);
}

View File

@ -103,6 +103,7 @@ struct proxy_data
HANDLE abort_event;
HANDLE client_thread;
HANDLE gfx_server_ready;
};
BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src);

View File

@ -362,6 +362,7 @@ static UINT pf_rdpgfx_map_surface_to_scaled_output(
static UINT pf_rdpgfx_on_open(RdpgfxClientContext* context, BOOL* do_caps_advertise,
BOOL* send_frame_acks)
{
proxyData* pdata = (proxyData*)context->custom;
WLog_VRB(TAG, __FUNCTION__);
if (NULL != do_caps_advertise)
@ -370,6 +371,8 @@ static UINT pf_rdpgfx_on_open(RdpgfxClientContext* context, BOOL* do_caps_advert
if (NULL != send_frame_acks)
*send_frame_acks = FALSE;
/* do not open the channel before gfx server side is in ready state */
WaitForSingleObject(pdata->gfx_server_ready, INFINITE);
return CHANNEL_RC_OK;
}