server: proxy: refactor pf_context_create_client_context
This commit is contained in:
parent
b6730ea31e
commit
4d175f6008
@ -138,9 +138,10 @@ BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rdpContext* pf_context_create_client_context(rdpSettings* clientSettings)
|
||||
pClientContext* pf_context_create_client_context(rdpSettings* clientSettings)
|
||||
{
|
||||
RDP_CLIENT_ENTRY_POINTS clientEntryPoints;
|
||||
pClientContext* pc;
|
||||
rdpContext* context;
|
||||
RdpClientEntry(&clientEntryPoints);
|
||||
context = freerdp_client_context_new(&clientEntryPoints);
|
||||
@ -148,10 +149,12 @@ rdpContext* pf_context_create_client_context(rdpSettings* clientSettings)
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
pc = (pClientContext*) context;
|
||||
|
||||
if (!pf_context_copy_settings(context->settings, clientSettings))
|
||||
goto error;
|
||||
|
||||
return context;
|
||||
return pc;
|
||||
error:
|
||||
freerdp_client_context_free(context);
|
||||
return NULL;
|
||||
|
@ -101,7 +101,7 @@ struct proxy_data
|
||||
|
||||
BOOL pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src);
|
||||
BOOL pf_context_init_server_context(freerdp_peer* client);
|
||||
rdpContext* pf_context_create_client_context(rdpSettings* clientSettings);
|
||||
pClientContext* pf_context_create_client_context(rdpSettings* clientSettings);
|
||||
|
||||
proxyData* proxy_data_new(void);
|
||||
void proxy_data_free(proxyData* pdata);
|
||||
|
@ -138,7 +138,8 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
|
||||
static BOOL pf_server_post_connect(freerdp_peer* client)
|
||||
{
|
||||
pServerContext* ps;
|
||||
rdpContext* pc;
|
||||
pClientContext* pc;
|
||||
rdpSettings* client_settings;
|
||||
proxyData* pdata;
|
||||
ps = (pServerContext*)client->context;
|
||||
pdata = ps->pdata;
|
||||
@ -150,18 +151,20 @@ static BOOL pf_server_post_connect(freerdp_peer* client)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* keep both sides of the connection in pdata */
|
||||
((pClientContext*)pc)->pdata = ps->pdata;
|
||||
pdata->pc = (pClientContext*)pc;
|
||||
client_settings = pc->context.settings;
|
||||
|
||||
if (!pf_server_get_target_info(client->context, pc->settings, pdata->config))
|
||||
/* keep both sides of the connection in pdata */
|
||||
pc->pdata = ps->pdata;
|
||||
pdata->pc = pc;
|
||||
|
||||
if (!pf_server_get_target_info(client->context, client_settings, pdata->config))
|
||||
{
|
||||
WLog_ERR(TAG, "pf_server_post_connect(): pf_server_get_target_info failed!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WLog_INFO(TAG, "pf_server_post_connect(): target == %s:%"PRIu16"", pc->settings->ServerHostname,
|
||||
pc->settings->ServerPort);
|
||||
WLog_INFO(TAG, "pf_server_post_connect(): target == %s:%"PRIu16"",
|
||||
client_settings->ServerHostname, client_settings->ServerPort);
|
||||
|
||||
if (!pf_server_channels_init(ps))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user