Merge pull request #2322 from akallabeth/channel_load_once

Preventing channels from being loaded twice
This commit is contained in:
Marc-André Moreau 2015-01-22 16:05:41 -05:00
commit 27af9786e2

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;