コード例 #1
0
ファイル: transport.c プロジェクト: MrRecovery/FreeRDP
static void* transport_client_thread(void* arg)
{
	DWORD status;
	DWORD nCount;
	HANDLE handles[8];
	freerdp* instance;
	rdpContext* context;
	rdpTransport* transport;
	transport = (rdpTransport*) arg;
	assert(NULL != transport);
	assert(NULL != transport->settings);
	instance = (freerdp*) transport->settings->instance;
	assert(NULL != instance);
	context = instance->context;
	assert(NULL != instance->context);
	WLog_Print(transport->log, WLOG_DEBUG, "Starting transport thread");
	nCount = 0;
	handles[nCount++] = transport->stopEvent;
	handles[nCount++] = transport->connectedEvent;
	status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);

	if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
	{
		WLog_Print(transport->log, WLOG_DEBUG, "Terminating transport thread");
		ExitThread(0);
		return NULL;
	}

	WLog_Print(transport->log, WLOG_DEBUG, "Asynchronous transport activated");

	while (1)
	{
		nCount = 0;
		handles[nCount++] = transport->stopEvent;
		transport_get_read_handles(transport, (HANDLE*) &handles, &nCount);
		status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);

		if (transport->layer == TRANSPORT_LAYER_CLOSED)
		{
			rdpRdp* rdp = (rdpRdp*) transport->rdp;
			rdp_set_error_info(rdp, ERRINFO_PEER_DISCONNECTED);
			break;
		}
		else if (status != WAIT_TIMEOUT)
		{
			if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
				break;

			if (!freerdp_check_fds(instance))
			{
			}
		}
	}

	WLog_Print(transport->log, WLOG_DEBUG, "Terminating transport thread");
	ExitThread(0);
	return NULL;
}
コード例 #2
0
ファイル: transport.c プロジェクト: lenky0401/FreeRDP
static void* transport_client_thread(void* arg)
{
	DWORD status;
	DWORD nCount;
	HANDLE handles[8];
	freerdp* instance;
	rdpContext* context;
	rdpTransport* transport;

	transport = (rdpTransport*) arg;
	assert(NULL != transport);
	assert(NULL != transport->settings);
	
	instance = (freerdp*) transport->settings->instance;
	assert(NULL != instance);
	
	context = instance->context;
	assert(NULL != instance->context);
	
	WLog_Print(transport->log, WLOG_DEBUG, "Starting transport thread");

	nCount = 0;
	handles[nCount++] = transport->stopEvent;
	handles[nCount++] = transport->connectedEvent;
	
	status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
	
	if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
	{
		WLog_Print(transport->log, WLOG_DEBUG, "Terminating transport thread");
		ExitThread(0);
		return NULL;
	}

	WLog_Print(transport->log, WLOG_DEBUG, "Asynchronous transport activated");

	while (1)
	{
		nCount = 0;
		handles[nCount++] = transport->stopEvent;

		transport_get_read_handles(transport, (HANDLE*) &handles, &nCount);

		status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);

		if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
			break;

		if (!freerdp_check_fds(instance))
			break;
	}

	WLog_Print(transport->log, WLOG_DEBUG, "Terminating transport thread");

	ExitThread(0);
	return NULL;
}
コード例 #3
0
ファイル: transport.c プロジェクト: AlessioLeo/FreeRDP
static void* transport_client_thread(void* arg)
{
	DWORD status;
	DWORD nCount;
	HANDLE events[32];
	freerdp* instance;
	rdpContext* context;
	rdpTransport* transport;

	transport = (rdpTransport*) arg;
	assert(NULL != transport);
	assert(NULL != transport->settings);
	
	instance = (freerdp*) transport->settings->instance;
	assert(NULL != instance);
	
	context = instance->context;
	assert(NULL != instance->context);

	while (1)
	{
		nCount = 0;
		events[nCount++] = transport->stopEvent;
		events[nCount] = transport->connectedEvent;

		status = WaitForMultipleObjects(nCount + 1, events, FALSE, INFINITE);
		if (status == WAIT_OBJECT_0)
			break;

		transport_get_read_handles(transport, (HANDLE*) &events, &nCount);
		status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
		if (status == WAIT_OBJECT_0)
			break;

		if (!freerdp_check_fds(instance))
			break;
	}

	ExitThread(0);

	return NULL;
}
コード例 #4
0
ファイル: transport.c プロジェクト: Nigel62/FreeRDP
static void* transport_client_thread(void* arg)
{
	DWORD status;
	DWORD nCount;
	HANDLE events[32];
	freerdp* instance;
	rdpTransport* transport;

	transport = (rdpTransport*) arg;
	instance = (freerdp*) transport->settings->instance;

	while (1)
	{
		nCount = 0;
		events[nCount++] = transport->stopEvent;

		events[nCount] = transport->connectedEvent;

		status = WaitForMultipleObjects(nCount + 1, events, FALSE, INFINITE);

		if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
		{
			break;
		}

		transport_get_read_handles(transport, (HANDLE*) &events, &nCount);

		status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);

		if (WaitForSingleObject(transport->stopEvent, 0) == WAIT_OBJECT_0)
		{
			break;
		}

		if (!freerdp_check_fds(instance))
			break;
	}

	return NULL;
}