Esempio n. 1
0
void NHandsFree::
eventLoop()
{
	/*
	 * Currently, this function's only purpose is to poll
	 * sockets and push I/O-bound processes.
	 * It's a hack.  It will be here until libnghost gets a
	 * proper I/O notification mechanism.
	 */
	switch (m_hfpd_state) {
	case NHS_HFPD_DISCONNECTED:
		/* Nothing to poll */
		return;

	case NHS_HFPD_CONNECTING: {
		fd_set wfds;
		struct timeval tv;

		/* Test if m_sock is writable */
		FD_ZERO(&wfds);
		FD_SET(m_sock, &wfds);
		tv.tv_sec = tv.tv_usec = 0;
		if (select(m_sock + 1, NULL, &wfds, NULL, &tv) <= 0)
			return;
	}
		ConnectNotify();
		return;

	case NHS_HFPD_CONNECTED:
		/* We just let read return EAGAIN every time here */
		DataReady();
		break;

	default:
		abort();
	}
}
Esempio n. 2
0
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
	
	ConnectNotify(NULL);
	return 0;
}