Preventing channels from being loaded twice

Skipping channels already loaded in freerdp_channels_client_load
This prevents channels already loaded in a context to be added a
second time to the channel list.
This commit is contained in:
Armin Novak 2015-01-20 18:01:33 +01:00
parent e5dee8fd3a
commit 34b700dd0f

View File

@ -642,6 +642,21 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG
return CHANNEL_RC_OK;
}
static BOOL freerdp_channels_is_loaded(rdpChannels* channels, PVIRTUALCHANNELENTRY entry)
{
int i;
for (i=0; i<channels->clientDataCount; i++)
{
CHANNEL_CLIENT_DATA* pChannelClientData = &channels->clientDataList[i];
if (pChannelClientData->entry == entry)
return TRUE;
}
return FALSE;
}
int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, PVIRTUALCHANNELENTRY entry, void* data)
{
int status;
@ -654,6 +669,12 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, P
return 1;
}
if (freerdp_channels_is_loaded(channels, entry))
{
WLog_WARN(TAG, "Skipping, channel already loaded");
return 0;
}
pChannelClientData = &channels->clientDataList[channels->clientDataCount];
pChannelClientData->entry = entry;