Exemplo n.º 1
0
void SyncHandler::ProcessActiveSessionList()
{
	SESSION_LIST_ITER 	it;
	Session 		*pSession;
	
	for (it = m_pActiveSessionList->begin(); it != m_pActiveSessionList->end(); ++it)
	{
		pSession = *it;
		
		if ( pSession->ShouldBeRemoved() ){
			continue;
		}
		
		if ( pSession->HasDisconnectOrdered() ) {
			if ( pSession->GetSendBuffer()->GetLength() == 0 ) {
				pSession->Remove();
			}
		}
		else
		{
			if ( pSession->IsAcceptSocket() && pSession->IsOnIdle() ) {
				//pSession->OnLogString( "Idle Session." );
				pSession->Remove();
				continue;
			}
			
			if ( !pSession->ProcessRecvdPacket(m_dwMaxPacketSize) ) {
				pSession->Remove();
			}
		}
	}
}