Пример #1
0
ISocketMultiplexerJob*
SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
				bool, bool write, bool error)
{
	Lock lock(&getMutex());

	int status = 0;
#ifdef SYSAPI_WIN32
	status = secureAccept(static_cast<int>(getSocket()->m_socket));
#elif SYSAPI_UNIX
	status = secureAccept(getSocket()->m_fd);
#endif
		// If status < 0, error happened
	if (status < 0) {
		return NULL;
	}

	// If status > 0, success
	if (status > 0) {
		sendEvent(m_events->forClientListener().accepted());
		return newJob();
	}

	// Retry case
	return new TSocketMultiplexerMethodJob<SecureSocket>(
			this, &SecureSocket::serviceAccept,
			getSocket(), isReadable(), isWritable());
}
Пример #2
0
ISocketMultiplexerJob*
SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
				bool, bool write, bool error)
{
	Lock lock(&getMutex());

	int status = 0;
#ifdef SYSAPI_WIN32
	status = secureAccept(static_cast<int>(getSocket()->m_socket));
#elif SYSAPI_UNIX
	status = secureAccept(getSocket()->m_fd);
#endif

	if (status > 0) {
		return newJob();
	}
	else if (status == 0) {
		return job;
	}
	// If status < 0, error happened
	return NULL;
}