Clear dynamic channel lists on disconnect.
@@ -380,10 +380,24 @@ static void dvcman_channel_free(void* arg)
free(channel);
}
+static void dvcman_clear(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
+{
+ DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
+
+ WINPR_UNUSED(drdynvc);
+
+ ArrayList_Clear(dvcman->plugins);
+ ArrayList_Clear(dvcman->channels);
+ ArrayList_Clear(dvcman->plugin_names);
+ ArrayList_Clear(dvcman->listeners);
+}
+
static void dvcman_free(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr)
{
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
+ WINPR_UNUSED(drdynvc);
+
ArrayList_Free(dvcman->plugins);
ArrayList_Free(dvcman->channels);
ArrayList_Free(dvcman->plugin_names);
@@ -472,7 +486,6 @@ static UINT dvcman_create_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelMana
BOOL bAccept;
DVCMAN_CHANNEL* channel;
DrdynvcClientContext* context;
- IWTSVirtualChannelCallback* pCallback;
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
UINT error;
@@ -493,10 +506,10 @@ static UINT dvcman_create_channel(drdynvcPlugin* drdynvc, IWTSVirtualChannelMana
if (strcmp(listener->channel_name, ChannelName) == 0)
{
+ IWTSVirtualChannelCallback* pCallback = NULL;
channel->iface.Write = dvcman_write_channel;
channel->iface.Close = dvcman_close_channel_iface;
bAccept = TRUE;
- pCallback = NULL;
if ((error = listener->listener_callback->OnNewChannelConnection(
listener->listener_callback, &channel->iface, NULL, &bAccept, &pCallback)) ==
@@ -1546,6 +1559,8 @@ static UINT drdynvc_virtual_channel_event_disconnected(drdynvcPlugin* drdynvc)
WTSErrorToString(status), status);
}
+ dvcman_clear(drdynvc, drdynvc->channel_mgr);
+ MessageQueue_Clear(drdynvc->queue);
drdynvc->OpenHandle = 0;
if (drdynvc->data_in)
