commit
c856bf263e
@ -37,8 +37,6 @@ set(${MODULE_PREFIX}_SRCS
|
||||
pf_disp.h
|
||||
pf_server.c
|
||||
pf_server.h
|
||||
pf_common.c
|
||||
pf_common.h
|
||||
pf_gdi.c
|
||||
pf_gdi.h
|
||||
pf_config.c
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "pf_channels.h"
|
||||
#include "pf_gdi.h"
|
||||
#include "pf_graphics.h"
|
||||
#include "pf_common.h"
|
||||
#include "pf_client.h"
|
||||
#include "pf_context.h"
|
||||
#include "pf_update.h"
|
||||
@ -214,7 +213,7 @@ static void pf_client_post_disconnect(freerdp* instance)
|
||||
/* proxy's client failed to connect, and now it's trying to connect without NLA, no need to shutdown
|
||||
* the connection between proxy's server and the original client.
|
||||
*/
|
||||
SetEvent(pdata->connectionClosed);
|
||||
proxy_data_abort_connect(pdata);
|
||||
}
|
||||
|
||||
/* It's important to avoid calling `freerdp_peer_context_free` and `freerdp_peer_free` here,
|
||||
@ -235,7 +234,12 @@ static DWORD WINAPI pf_client_thread_proc(LPVOID arg)
|
||||
DWORD status;
|
||||
HANDLE handles[64];
|
||||
|
||||
pc->during_connect_process = TRUE;
|
||||
/* Only set the `during_connect_process` flag if NlaSecurity is enabled.
|
||||
* If NLASecurity isn't enabled, the connection should be closed right after the first failure.
|
||||
*/
|
||||
if (instance->settings->NlaSecurity)
|
||||
pc->during_connect_process = TRUE;
|
||||
|
||||
if (!freerdp_connect(instance))
|
||||
{
|
||||
if (instance->settings->NlaSecurity)
|
||||
@ -397,14 +401,18 @@ static BOOL pf_client_client_new(freerdp* instance, rdpContext* context)
|
||||
static int pf_client_client_stop(rdpContext* context)
|
||||
{
|
||||
pClientContext* pc = (pClientContext*) context;
|
||||
pServerContext* ps = pc->pdata->ps;
|
||||
proxyData* pdata = pc->pdata;
|
||||
WLog_DBG(TAG, "aborting client connection");
|
||||
freerdp_abort_connect(context->instance);
|
||||
|
||||
if (ps->thread)
|
||||
if (pdata->client_thread)
|
||||
{
|
||||
WaitForSingleObject(ps->thread, INFINITE);
|
||||
CloseHandle(ps->thread);
|
||||
ps->thread = NULL;
|
||||
/* Wait for client thread to finish. No need to call CloseHandle() here, as
|
||||
* it is the responsibility of `proxy_data_free`.
|
||||
*/
|
||||
WLog_DBG(TAG, "pf_client_client_stop(): waiting for thread to finish");
|
||||
WaitForSingleObject(pdata->client_thread, INFINITE);
|
||||
WLog_DBG(TAG, "pf_client_client_stop(): thread finished");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,112 +0,0 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* FreeRDP Proxy Server
|
||||
*
|
||||
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
|
||||
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
|
||||
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "pf_common.h"
|
||||
|
||||
BOOL pf_common_connection_aborted_by_peer(proxyData* pdata)
|
||||
{
|
||||
return WaitForSingleObject(pdata->connectionClosed, 0) == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
void pf_common_copy_settings(rdpSettings* dst, rdpSettings* src)
|
||||
{
|
||||
/* Client/server CORE options */
|
||||
dst->RdpVersion = src->RdpVersion;
|
||||
dst->DesktopWidth = src->DesktopWidth;
|
||||
dst->DesktopHeight = src->DesktopHeight;
|
||||
dst->ColorDepth = src->ColorDepth;
|
||||
dst->ConnectionType = src->ConnectionType;
|
||||
dst->ClientBuild = src->ClientBuild;
|
||||
dst->ClientHostname = _strdup(src->ClientHostname);
|
||||
dst->ClientProductId = _strdup(src->ClientProductId);
|
||||
dst->EarlyCapabilityFlags = src->EarlyCapabilityFlags;
|
||||
dst->NetworkAutoDetect = src->NetworkAutoDetect;
|
||||
dst->SupportAsymetricKeys = src->SupportAsymetricKeys;
|
||||
dst->SupportErrorInfoPdu = src->SupportErrorInfoPdu;
|
||||
dst->SupportStatusInfoPdu = src->SupportStatusInfoPdu;
|
||||
dst->SupportMonitorLayoutPdu = src->SupportMonitorLayoutPdu;
|
||||
dst->SupportGraphicsPipeline = src->SupportGraphicsPipeline;
|
||||
dst->SupportDynamicTimeZone = src->SupportDynamicTimeZone;
|
||||
dst->SupportHeartbeatPdu = src->SupportHeartbeatPdu;
|
||||
dst->DesktopPhysicalWidth = src->DesktopPhysicalWidth;
|
||||
dst->DesktopPhysicalHeight = src->DesktopPhysicalHeight;
|
||||
dst->DesktopOrientation = src->DesktopOrientation;
|
||||
dst->DesktopScaleFactor = src->DesktopScaleFactor;
|
||||
dst->DeviceScaleFactor = src->DeviceScaleFactor;
|
||||
dst->SupportMonitorLayoutPdu = src->SupportMonitorLayoutPdu;
|
||||
/* client info */
|
||||
dst->AutoLogonEnabled = src->AutoLogonEnabled;
|
||||
dst->CompressionEnabled = src->CompressionEnabled;
|
||||
dst->DisableCtrlAltDel = src->DisableCtrlAltDel;
|
||||
dst->EnableWindowsKey = src->EnableWindowsKey;
|
||||
dst->MaximizeShell = src->MaximizeShell;
|
||||
dst->LogonNotify = src->LogonNotify;
|
||||
dst->LogonErrors = src->LogonErrors;
|
||||
dst->MouseAttached = src->MouseAttached;
|
||||
dst->MouseHasWheel = src->MouseHasWheel;
|
||||
dst->RemoteConsoleAudio = src->RemoteConsoleAudio;
|
||||
dst->AudioPlayback = src->AudioPlayback;
|
||||
dst->AudioCapture = src->AudioCapture;
|
||||
dst->VideoDisable = src->VideoDisable;
|
||||
dst->PasswordIsSmartcardPin = src->PasswordIsSmartcardPin;
|
||||
dst->UsingSavedCredentials = src->UsingSavedCredentials;
|
||||
dst->ForceEncryptedCsPdu = src->ForceEncryptedCsPdu;
|
||||
dst->HiDefRemoteApp = src->HiDefRemoteApp;
|
||||
dst->CompressionLevel = src->CompressionLevel;
|
||||
dst->PerformanceFlags = src->PerformanceFlags;
|
||||
dst->AllowFontSmoothing = src->AllowFontSmoothing;
|
||||
dst->DisableWallpaper = src->DisableWallpaper;
|
||||
dst->DisableFullWindowDrag = src->DisableFullWindowDrag;
|
||||
dst->DisableMenuAnims = src->DisableMenuAnims;
|
||||
dst->DisableThemes = src->DisableThemes;
|
||||
dst->DisableCursorShadow = src->DisableCursorShadow;
|
||||
dst->DisableCursorBlinking = src->DisableCursorBlinking;
|
||||
dst->AllowDesktopComposition = src->AllowDesktopComposition;
|
||||
dst->DisableThemes = src->DisableThemes;
|
||||
/* Remote App */
|
||||
dst->RemoteApplicationMode = src->RemoteApplicationMode;
|
||||
dst->RemoteApplicationName = src->RemoteApplicationName;
|
||||
dst->RemoteApplicationIcon = src->RemoteApplicationIcon;
|
||||
dst->RemoteApplicationProgram = src->RemoteApplicationProgram;
|
||||
dst->RemoteApplicationFile = src->RemoteApplicationFile;
|
||||
dst->RemoteApplicationGuid = src->RemoteApplicationGuid;
|
||||
dst->RemoteApplicationCmdLine = src->RemoteApplicationCmdLine;
|
||||
dst->RemoteApplicationExpandCmdLine = src->RemoteApplicationExpandCmdLine;
|
||||
dst->RemoteApplicationExpandWorkingDir = src->RemoteApplicationExpandWorkingDir;
|
||||
dst->DisableRemoteAppCapsCheck = src->DisableRemoteAppCapsCheck;
|
||||
dst->RemoteAppNumIconCaches = src->RemoteAppNumIconCaches;
|
||||
dst->RemoteAppNumIconCacheEntries = src->RemoteAppNumIconCacheEntries;
|
||||
dst->RemoteAppLanguageBarSupported = src->RemoteAppLanguageBarSupported;
|
||||
dst->RemoteWndSupportLevel = src->RemoteWndSupportLevel;
|
||||
/* GFX */
|
||||
dst->GfxThinClient = src->GfxThinClient;
|
||||
dst->GfxSmallCache = src->GfxSmallCache;
|
||||
dst->GfxProgressive = src->GfxProgressive;
|
||||
dst->GfxProgressiveV2 = src->GfxProgressiveV2;
|
||||
dst->GfxH264 = src->GfxH264;
|
||||
dst->GfxAVC444 = src->GfxAVC444;
|
||||
dst->GfxSendQoeAck = src->GfxSendQoeAck;
|
||||
dst->GfxAVC444v2 = src->GfxAVC444v2;
|
||||
dst->SupportDisplayControl = src->SupportDisplayControl;
|
||||
dst->SupportMonitorLayoutPdu = src->SupportMonitorLayoutPdu;
|
||||
dst->DynamicResolutionUpdate = src->DynamicResolutionUpdate;
|
||||
dst->DesktopResize = src->DesktopResize;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* FreeRDP Proxy Server
|
||||
*
|
||||
* Copyright 2019 Mati Shabtay <matishabtay@gmail.com>
|
||||
* Copyright 2019 Kobi Mizrachi <kmizrachi18@gmail.com>
|
||||
* Copyright 2019 Idan Freiberg <speidy@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_SERVER_PROXY_PFCOMMON_H
|
||||
#define FREERDP_SERVER_PROXY_PFCOMMON_H
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include "pf_context.h"
|
||||
|
||||
BOOL pf_common_connection_aborted_by_peer(proxyData* pdata);
|
||||
void pf_common_copy_settings(rdpSettings* dst, rdpSettings* src);
|
||||
|
||||
#endif /* FREERDP_SERVER_PROXY_PFCOMMON_H */
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "pf_client.h"
|
||||
#include "pf_context.h"
|
||||
#include "pf_common.h"
|
||||
|
||||
/* Proxy context initialization callback */
|
||||
static BOOL client_to_proxy_context_new(freerdp_peer* client,
|
||||
@ -162,7 +161,7 @@ proxyData* proxy_data_new()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(pdata->connectionClosed = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
||||
if (!(pdata->abort_event = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
||||
{
|
||||
proxy_data_free(pdata);
|
||||
return NULL;
|
||||
@ -192,11 +191,27 @@ out_fail:
|
||||
void proxy_data_free(proxyData* pdata)
|
||||
{
|
||||
connection_info_free(pdata->info);
|
||||
if (pdata->connectionClosed)
|
||||
if (pdata->abort_event)
|
||||
{
|
||||
CloseHandle(pdata->connectionClosed);
|
||||
pdata->connectionClosed = NULL;
|
||||
CloseHandle(pdata->abort_event);
|
||||
pdata->abort_event = NULL;
|
||||
}
|
||||
|
||||
if (pdata->client_thread)
|
||||
{
|
||||
CloseHandle(pdata->client_thread);
|
||||
pdata->client_thread = NULL;
|
||||
}
|
||||
|
||||
free(pdata);
|
||||
}
|
||||
|
||||
void proxy_data_abort_connect(proxyData* pdata)
|
||||
{
|
||||
SetEvent(pdata->abort_event);
|
||||
}
|
||||
|
||||
BOOL proxy_data_shall_disconnect(proxyData* pdata)
|
||||
{
|
||||
return WaitForSingleObject(pdata->abort_event, 0) == WAIT_OBJECT_0;
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ struct p_server_context
|
||||
proxyData* pdata;
|
||||
|
||||
HANDLE vcm;
|
||||
HANDLE thread;
|
||||
HANDLE dynvcReady;
|
||||
|
||||
RdpgfxServerContext* gfx;
|
||||
@ -91,17 +90,25 @@ struct proxy_data
|
||||
pServerContext* ps;
|
||||
pClientContext* pc;
|
||||
|
||||
HANDLE connectionClosed;
|
||||
HANDLE abort_event;
|
||||
HANDLE client_thread;
|
||||
|
||||
connectionInfo* info;
|
||||
filters_list* filters;
|
||||
};
|
||||
|
||||
BOOL init_p_server_context(freerdp_peer* client);
|
||||
/* client */
|
||||
rdpContext* p_client_context_create(rdpSettings* clientSettings);
|
||||
|
||||
/* pdata */
|
||||
proxyData* proxy_data_new();
|
||||
BOOL proxy_data_set_connection_info(proxyData* pdata, rdpSettings* ps, rdpSettings* pc);
|
||||
void proxy_data_free(proxyData* pdata);
|
||||
void pf_context_copy_settings(rdpSettings* dst, const rdpSettings* src, BOOL is_server);
|
||||
void proxy_data_abort_connect(proxyData* pdata);
|
||||
BOOL proxy_data_shall_disconnect(proxyData* pdata);
|
||||
|
||||
/* server */
|
||||
BOOL init_p_server_context(freerdp_peer* client);
|
||||
|
||||
#endif /* FREERDP_SERVER_PROXY_PFCONTEXT_H */
|
||||
|
@ -93,7 +93,7 @@ PF_FILTER_RESULT pf_filters_run_by_type(filters_list* list, PF_FILTER_TYPE type,
|
||||
{
|
||||
filter = (proxyFilter*) ArrayList_GetItem(list, index);
|
||||
events = filter->events;
|
||||
WLog_DBG(TAG, "pf_filters_run_by_type(): Running filter: %s", filter->name);
|
||||
WLog_VRB(TAG, "pf_filters_run_by_type(): Running filter: %s", filter->name);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ static UINT pf_rdpgfx_reset_graphics(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->ResetGraphics(server, resetGraphics);
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ static UINT pf_rdpgfx_start_frame(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->StartFrame(server, startFrame);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ static UINT pf_rdpgfx_end_frame(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->EndFrame(server, endFrame);
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ static UINT pf_rdpgfx_surface_command(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->SurfaceCommand(server, cmd);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ static UINT pf_rdpgfx_delete_encoding_context(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->DeleteEncodingContext(server, deleteEncodingContext);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ static UINT pf_rdpgfx_create_surface(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->CreateSurface(server, createSurface);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ static UINT pf_rdpgfx_delete_surface(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->DeleteSurface(server, deleteSurface);
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ static UINT pf_rdpgfx_solid_fill(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->SolidFill(server, solidFill);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ static UINT pf_rdpgfx_surface_to_surface(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->SurfaceToSurface(server, surfaceToSurface);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ static UINT pf_rdpgfx_surface_to_cache(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->SurfaceToCache(server, surfaceToCache);
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ static UINT pf_rdpgfx_cache_to_surface(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->CacheToSurface(server, cacheToSurface);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ static UINT pf_rdpgfx_cache_import_reply(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->CacheImportReply(server, cacheImportReply);
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ static UINT pf_rdpgfx_evict_cache_entry(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->EvictCacheEntry(server, evictCacheEntry);
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ static UINT pf_rdpgfx_map_surface_to_output(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->MapSurfaceToOutput(server, surfaceToOutput);
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ static UINT pf_rdpgfx_map_surface_to_window(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->MapSurfaceToWindow(server, surfaceToWindow);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ static UINT pf_rdpgfx_map_surface_to_scaled_window(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->MapSurfaceToScaledWindow(server, surfaceToScaledWindow);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ static UINT pf_rdpgfx_map_surface_to_scaled_output(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->MapSurfaceToScaledOutput(server, surfaceToScaledOutput);
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ static UINT pf_rdpgfx_on_open(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
|
||||
if (NULL != do_caps_advertise)
|
||||
*do_caps_advertise = FALSE;
|
||||
@ -229,7 +229,7 @@ static UINT pf_rdpgfx_on_close(RdpgfxClientContext* context)
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->Close(server) ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ static UINT pf_rdpgfx_caps_confirm(RdpgfxClientContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxServerContext* server = (RdpgfxServerContext*) pdata->ps->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return server->CapsConfirm(server, capsConfirm);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ static UINT pf_rdpgfx_caps_advertise(RdpgfxServerContext* context,
|
||||
|
||||
supportedCapsAdvertise.capsSetCount = proxySupportedCapsSetCount;
|
||||
supportedCapsAdvertise.capsSets = proxySupportedCapsSets;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return client->CapsAdvertise(client, &supportedCapsAdvertise);
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ static UINT pf_rdpgfx_frame_acknowledge(RdpgfxServerContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxClientContext* client = (RdpgfxClientContext*) pdata->pc->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return client->FrameAcknowledge(client, frameAcknowledge);
|
||||
}
|
||||
|
||||
@ -291,7 +291,7 @@ static UINT pf_rdpgfx_qoe_frame_acknowledge(RdpgfxServerContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxClientContext* client = (RdpgfxClientContext*) pdata->pc->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return client->QoeFrameAcknowledge(client, qoeFrameAcknowledge);
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ static UINT pf_rdpgfx_cache_import_offer(RdpgfxServerContext* context,
|
||||
{
|
||||
proxyData* pdata = (proxyData*) context->custom;
|
||||
RdpgfxClientContext* client = (RdpgfxClientContext*) pdata->pc->gfx;
|
||||
WLog_DBG(TAG, __FUNCTION__);
|
||||
WLog_VRB(TAG, __FUNCTION__);
|
||||
return client->CacheImportOffer(client, cacheImportOffer);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include <freerdp/server/rdpgfx.h>
|
||||
|
||||
#include "pf_server.h"
|
||||
#include "pf_common.h"
|
||||
#include "pf_log.h"
|
||||
#include "pf_config.h"
|
||||
#include "pf_client.h"
|
||||
@ -53,23 +52,6 @@
|
||||
|
||||
#define TAG PROXY_TAG("server")
|
||||
|
||||
static void pf_server_handle_client_disconnection(freerdp_peer* client)
|
||||
{
|
||||
pServerContext* ps = (pServerContext*)client->context;
|
||||
rdpContext* pc = (rdpContext*) ps->pdata->pc;
|
||||
proxyData* pdata = ps->pdata;
|
||||
WLog_INFO(TAG, "Connection with %s was closed; closing proxy's client <> target server connection %s",
|
||||
client->hostname, pc->settings->ServerHostname);
|
||||
/* Mark connection closed for sContext */
|
||||
SetEvent(pdata->connectionClosed);
|
||||
freerdp_abort_connect(pc->instance);
|
||||
/* Close connection to remote host */
|
||||
WLog_DBG(TAG, "Waiting for proxy's client thread to finish");
|
||||
WaitForSingleObject(ps->thread, INFINITE);
|
||||
CloseHandle(ps->thread);
|
||||
ps->thread = NULL;
|
||||
}
|
||||
|
||||
static BOOL pf_server_parse_target_from_routing_token(rdpContext* context,
|
||||
char** target, DWORD* port)
|
||||
{
|
||||
@ -183,7 +165,7 @@ static BOOL pf_server_post_connect(freerdp_peer* client)
|
||||
pf_server_disp_init(ps);
|
||||
|
||||
/* Start a proxy's client in it's own thread */
|
||||
if (!(ps->thread = CreateThread(NULL, 0, pf_client_start, pc, 0, NULL)))
|
||||
if (!(pdata->client_thread = CreateThread(NULL, 0, pf_client_start, pc, 0, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateThread failed!");
|
||||
return FALSE;
|
||||
@ -296,7 +278,7 @@ static DWORD WINAPI pf_server_handle_client(LPVOID arg)
|
||||
eventCount += tmp;
|
||||
}
|
||||
eventHandles[eventCount++] = ChannelEvent;
|
||||
eventHandles[eventCount++] = pdata->connectionClosed;
|
||||
eventHandles[eventCount++] = pdata->abort_event;
|
||||
eventHandles[eventCount++] = WTSVirtualChannelManagerGetEventHandle(ps->vcm);
|
||||
status = WaitForMultipleObjects(eventCount, eventHandles, FALSE, INFINITE);
|
||||
|
||||
@ -306,12 +288,6 @@ static DWORD WINAPI pf_server_handle_client(LPVOID arg)
|
||||
break;
|
||||
}
|
||||
|
||||
if (pf_common_connection_aborted_by_peer(pdata))
|
||||
{
|
||||
WLog_INFO(TAG, "proxy's client disconnected, closing connection with client %s", client->hostname);
|
||||
break;
|
||||
}
|
||||
|
||||
if (client->CheckFileDescriptor(client) != TRUE)
|
||||
break;
|
||||
|
||||
@ -324,6 +300,13 @@ static DWORD WINAPI pf_server_handle_client(LPVOID arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* only disconnect after checking client's and vcm's file descriptors */
|
||||
if (proxy_data_shall_disconnect(pdata))
|
||||
{
|
||||
WLog_INFO(TAG, "abort_event is set, closing connection with client %s", client->hostname);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (WTSVirtualChannelManagerGetDrdynvcState(ps->vcm))
|
||||
{
|
||||
/* Dynamic channel status may have been changed after processing */
|
||||
@ -366,16 +349,15 @@ fail:
|
||||
|
||||
if (ps->gfx)
|
||||
rdpgfx_server_context_free(ps->gfx);
|
||||
|
||||
if (client->connected && !pf_common_connection_aborted_by_peer(pdata))
|
||||
{
|
||||
pf_server_handle_client_disconnection(client);
|
||||
}
|
||||
|
||||
pc = (rdpContext*) pdata->pc;
|
||||
WLog_INFO(TAG, "pf_server_handle_client(): starting shutdown of connection (client %s)", client->hostname);
|
||||
WLog_INFO(TAG, "pf_server_handle_client(): stopping proxy's client");
|
||||
freerdp_client_stop(pc);
|
||||
WLog_INFO(TAG, "pf_server_handle_client(): freeing proxy data");
|
||||
proxy_data_free(pdata);
|
||||
freerdp_client_context_free(pc);
|
||||
client->Close(client);
|
||||
client->Disconnect(client);
|
||||
out_free_peer:
|
||||
freerdp_peer_context_free(client);
|
||||
|
Loading…
x
Reference in New Issue
Block a user