Example #1
0
//=================================================================================================
void SyncHandler::ProcessConnectSuccessList()
{
	SESSION_LIST_ITER 	it;
	Session 		*pSession;
	SESSION_LIST		activeList;

	m_pConnectSuccessList->Lock();
	m_pTemplateList->splice( * m_pConnectSuccessList );
	m_pConnectSuccessList->Unlock();
	
	while( !m_pTemplateList->empty() ) 
	{
		pSession = m_pTemplateList->pop_front();
		
		if (this->AddEpollEvent( pSession )) {
			pSession->OnConnect(TRUE);
			activeList.push_back(pSession);
		}
		else {
			this->FreeSession(pSession);
			pSession->OnConnect(FALSE);
		}
	}
	
	if ( !activeList.empty() ) 
	{
		m_numActiveSessions += (DWORD) activeList.size();
		
		m_pActiveSessionList->Lock();
		m_pActiveSessionList->splice( activeList );
		m_pActiveSessionList->Unlock();
	}
}