コード例 #1
0
ファイル: rdpsnd_main.c プロジェクト: alama/freerdp
static void
InitEventProcessTerminated(void * pInitHandle)
{
	rdpsndPlugin * plugin;
	int index;
	struct data_in_item * in_item;
	struct data_out_item * out_item;

	plugin = (rdpsndPlugin *) chan_plugin_find_by_init_handle(pInitHandle);
	if (plugin == NULL)
	{
		LLOGLN(0, ("InitEventProcessConnected: error no match"));
		return;
	}

	wait_obj_set(plugin->term_event);
	index = 0;
	while ((plugin->thread_status > 0) && (index < 100))
	{
		index++;
		usleep(250 * 1000);
	}
	wait_obj_free(plugin->term_event);
	wait_obj_free(plugin->data_in_event);

	pthread_mutex_destroy(plugin->in_mutex);
	free(plugin->in_mutex);

	/* free the un-processed in/out queue */
	while (plugin->in_list_head != 0)
	{
		in_item = plugin->in_list_head;
		plugin->in_list_head = in_item->next;
		free(in_item->data);
		free(in_item);
	}
	while (plugin->out_list_head != 0)
	{
		out_item = plugin->out_list_head;
		plugin->out_list_head = out_item->next;
		free(out_item->data);
		free(out_item);
	}

	if (plugin->device_plugin)
	{
		plugin->device_plugin->free(plugin->device_plugin);
		free(plugin->device_plugin);
		plugin->device_plugin = NULL;
	}
	chan_plugin_uninit((rdpChanPlugin *) plugin);
	free(plugin);
}
コード例 #2
0
ファイル: rail_core_plugin.c プロジェクト: roman-b/FreeRDP
//------------------------------------------------------------------------------
static void
InitEventProcessTerminated(void * pInitHandle)
{
	railCorePlugin * plugin;
	int index;
	struct data_in_item * in_item;

	LLOGLN(10, ("rail_core_plugin:InitEventProcessTerminated: pInitHandle=0x%p",
			pInitHandle));

	plugin = (railCorePlugin *) chan_plugin_find_by_init_handle(pInitHandle);
	if (plugin == NULL)
	{
		LLOGLN(0, ("rail_core_plugin:InitEventProcessTerminated: error no match"));
		return;
	}


	wait_obj_set(plugin->term_event);
	index = 0;
	while ((plugin->thread_status > 0) && (index < 100))
	{
		index++;
		usleep(250 * 1000);
	}
	wait_obj_free(plugin->term_event);
	wait_obj_free(plugin->data_in_event);

	pthread_mutex_destroy(plugin->in_mutex);
	free(plugin->in_mutex);

	/* free the un-processed in/out queue */
	while (plugin->in_list_head != NULL)
	{
		in_item = plugin->in_list_head;
		plugin->in_list_head = in_item->next;
		free(in_item->data);
		free(in_item);
	}
	if (plugin->data_in != NULL)
	{
		free(plugin->data_in);
	}

	chan_plugin_uninit((rdpChanPlugin *) plugin);

	rail_on_channel_terminated(plugin->session);
	free(plugin);
}
コード例 #3
0
ファイル: wtsvc.c プロジェクト: railmeat/FreeRDP
boolean WTSVirtualChannelClose(
    /* __in */ void* hChannelHandle)
{
    wts_data_item* item;
    rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

    if (channel != NULL)
    {
        if (channel->index < channel->client->settings->num_channels)
            channel->client->settings->channels[channel->index].handle = NULL;
        stream_free(channel->receive_data);
        if (channel->receive_event)
            wait_obj_free(channel->receive_event);
        if (channel->receive_queue)
        {
            while ((item = (wts_data_item*) list_dequeue(channel->receive_queue)) != NULL)
            {
                wts_data_item_free(item);
            }
            list_free(channel->receive_queue);
        }
        if (channel->mutex)
            freerdp_mutex_free(channel->mutex);
        xfree(channel);
    }

    return true;
}
コード例 #4
0
ファイル: wtsvc.c プロジェクト: ArthurGodoy/FreeRDP
void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
{
	wts_data_item* item;
	rdpPeerChannel* channel;

	if (vcm != NULL)
	{
		while ((channel = (rdpPeerChannel*) list_dequeue(vcm->dvc_channel_list)) != NULL)
		{
			WTSVirtualChannelClose(channel);
		}
		list_free(vcm->dvc_channel_list);
		if (vcm->drdynvc_channel != NULL)
		{
			WTSVirtualChannelClose(vcm->drdynvc_channel);
			vcm->drdynvc_channel = NULL;
		}

		wait_obj_free(vcm->send_event);
		while ((item = (wts_data_item*) list_dequeue(vcm->send_queue)) != NULL)
		{
			wts_data_item_free(item);
		}
		list_free(vcm->send_queue);
		CloseHandle(vcm->mutex);
		xfree(vcm);
	}
}
コード例 #5
0
ファイル: libchannels.c プロジェクト: adambprotiviti/FreeRDP
void freerdp_channels_free(rdpChannels * chan_man)
{
	rdpChannelsList* list;
	rdpChannelsList* prev;

	freerdp_mutex_free(chan_man->sync_data_mutex);
	list_free(chan_man->sync_data_list);

	freerdp_sem_free(chan_man->event_sem);
	wait_obj_free(chan_man->signal);

	/* Remove from global list */
	freerdp_mutex_lock(g_mutex_list);
	for (prev = NULL, list = g_channels_list; list; prev = list, list = list->next)
	{
		if (list->channels == chan_man)
			break;
	}
	if (list)
	{
		if (prev)
			prev->next = list->next;
		else
			g_channels_list = list->next;
		xfree(list);
	}
	freerdp_mutex_unlock(g_mutex_list);

	xfree(chan_man);
}
コード例 #6
0
ファイル: thread.c プロジェクト: BillTheBest/FreeRDP
void freerdp_thread_free(freerdp_thread* thread)
{
	int i;

	for (i = 0; i < thread->num_signals; i++)
		wait_obj_free(thread->signals[i]);
	thread->num_signals = 0;

	freerdp_mutex_free(thread->mutex);
	thread->mutex = NULL;

	xfree(thread);
}
コード例 #7
0
ファイル: transport.c プロジェクト: racoon00/FreeRDP
void transport_free(rdpTransport* transport)
{
	if (transport != NULL)
	{
		stream_free(transport->recv_buffer);
		stream_free(transport->recv_stream);
		stream_free(transport->send_stream);
		wait_obj_free(transport->recv_event);
		if (transport->tls)
			tls_free(transport->tls);
		tcp_free(transport->tcp);
		xfree(transport);
	}
}
コード例 #8
0
ファイル: wtsvc.c プロジェクト: ArthurGodoy/FreeRDP
boolean WTSVirtualChannelClose(
	/* __in */ void* hChannelHandle)
{
	STREAM* s;
	wts_data_item* item;
	WTSVirtualChannelManager* vcm;
	rdpPeerChannel* channel = (rdpPeerChannel*) hChannelHandle;

	if (channel)
	{
		vcm = channel->vcm;

		if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
		{
			if (channel->index < channel->client->settings->num_channels)
				channel->client->settings->channels[channel->index].handle = NULL;
		}
		else
		{
			WaitForSingleObject(vcm->mutex, INFINITE);
			list_remove(vcm->dvc_channel_list, channel);
			ReleaseMutex(vcm->mutex);

			if (channel->dvc_open_state == DVC_OPEN_STATE_SUCCEEDED)
			{
				s = stream_new(8);
				wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channel_id);
				WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), stream_get_length(s), NULL);
				stream_free(s);
			}
		}
		if (channel->receive_data)
			stream_free(channel->receive_data);
		if (channel->receive_event)
			wait_obj_free(channel->receive_event);
		if (channel->receive_queue)
		{
			while ((item = (wts_data_item*) list_dequeue(channel->receive_queue)) != NULL)
			{
				wts_data_item_free(item);
			}
			list_free(channel->receive_queue);
		}
		if (channel->mutex)
			CloseHandle(channel->mutex);
		xfree(channel);
	}
	return true;
}
コード例 #9
0
ファイル: wtsvc.c プロジェクト: railmeat/FreeRDP
void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
{
    wts_data_item* item;

    if (vcm != NULL)
    {
        if (vcm->drdynvc_channel != NULL)
        {
            WTSVirtualChannelClose(vcm->drdynvc_channel);
            vcm->drdynvc_channel = NULL;
        }

        wait_obj_free(vcm->send_event);
        while ((item = (wts_data_item*) list_dequeue(vcm->send_queue)) != NULL)
        {
            wts_data_item_free(item);
        }
        list_free(vcm->send_queue);
        freerdp_mutex_free(vcm->mutex);
        xfree(vcm);
    }
}
コード例 #10
0
ファイル: test_utils.c プロジェクト: Cyclic/FreeRDP
void test_wait_obj(void)
{
	struct wait_obj* wo;
	int set;

	wo = wait_obj_new();

	set = wait_obj_is_set(wo);
	CU_ASSERT(set == 0);

	wait_obj_set(wo);
	set = wait_obj_is_set(wo);
	CU_ASSERT(set == 1);

	wait_obj_clear(wo);
	set = wait_obj_is_set(wo);
	CU_ASSERT(set == 0);

	wait_obj_select(&wo, 1, 1000);

	wait_obj_free(wo);
}