Do not terminate channel disconnect if one fails.

This commit is contained in:
Armin Novak 2017-01-17 16:00:51 +01:00
parent 221b5258fc
commit 56a1425bca

View File

@ -34,7 +34,8 @@
static WINPR_TLS void* g_pInterface = NULL;
static WINPR_TLS rdpChannels* g_channels = NULL; /* use only for VirtualChannelInit hack */
static volatile LONG g_OpenHandleSeq = 1; /* use global counter to ensure uniqueness across channel manager instances */
static volatile LONG g_OpenHandleSeq =
1; /* use global counter to ensure uniqueness across channel manager instances */
static WINPR_TLS rdpChannelHandles g_ChannelHandles = { NULL, NULL };
static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
@ -624,6 +625,7 @@ UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance)
/* tell all libraries we are shutting down */
for (index = 0; index < channels->clientDataCount; index++)
{
char* name[9];
ChannelDisconnectedEventArgs e;
pChannelClientData = &channels->clientDataList[index];
@ -639,24 +641,17 @@ UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance)
}
if (getChannelError(instance->context) != CHANNEL_RC_OK)
goto fail;
continue;
pChannelOpenData = &channels->openDataList[index];
name = (char*) malloc(9);
if (!name)
return -1;
CopyMemory(name, pChannelOpenData->name, 8);
name[8] = '\0';
EventArgsInit(&e, "freerdp");
e.name = name;
e.pInterface = pChannelOpenData->pInterface;
PubSub_OnChannelDisconnected(instance->context->pubSub, instance->context, &e);
free(name);
}
fail:
return error;
}
@ -837,7 +832,8 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle,
pChannelOpenData = &channels->openDataList[channels->openDataCount];
pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq);
pChannelOpenData->channels = channels;
freerdp_channel_add_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle, (void*) channels);
freerdp_channel_add_open_handle_data(&g_ChannelHandles, pChannelOpenData->OpenHandle,
(void*) channels);
HashTable_Add(channels->openHandles, (void*)(UINT_PTR) pChannelOpenData->OpenHandle,
(void*) pChannelOpenData);
pChannelOpenData->flags = 1; /* init */