Exemplo n.º 1
0
bool ServerManager::ProcessExceptions( )
{
	if(m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET)
	{
		return true;
	}

	for(int i=SCENE_PLAYER_ID; i<=BILLING_PLAYER_ID; i++)
	{
		ServerPlayer*	pPlayer = GetServerPlayer(i);
		if(!pPlayer) continue;

		if(pPlayer->IsValid())
		{
			SOCKET s = pPlayer->GetSocket()->getSOCKET();
			if(FD_ISSET( s, &m_ExceptFDs[SELECT_USE]) )
			{
				g_pLog->log_debug("%u,%u,ProcessException......",pPlayer->PlayerID(),0);
				RemoveServer(i);
			}
		}
	}

	return true;
}
Exemplo n.º 2
0
bool ServerManager::ProcessCommands( )
{
	bool ret = false;

	if(m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET)
	{
		return true;
	}

	for(int i=SCENE_PLAYER_ID; i<=BILLING_PLAYER_ID; i++)
	{
		ServerPlayer*	pPlayer = GetServerPlayer(i);
		if(!pPlayer) continue;

		if(pPlayer->IsValid())
		{
			if(pPlayer->GetSocket()->isSockError() )
			{
				RemoveServer(i);
			}
			else
			{
				ret = pPlayer->ProcessCommand(false);
				if(!ret)
				{
					RemoveServer( i );
				}
			}
		}
	}

	return true;
}
Exemplo n.º 3
0
bool ServerManager::ProcessOutputs( )
{
	bool ret = false;

	if(m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET)
	{
		return true;
	}

	for(int i=SCENE_PLAYER_ID; i<=BILLING_PLAYER_ID; i++)
	{
		ServerPlayer*	pPlayer = GetServerPlayer(i);
		if(!pPlayer) continue;

		if(pPlayer->IsValid())
		{
			SOCKET s = pPlayer->GetSocket()->getSOCKET();
			if(FD_ISSET( s, &m_WriteFDs[SELECT_USE]) )
			{
				if(pPlayer->GetSocket()->isSockError() )
				{
					RemoveServer(i);
				}
				else
				{
					ret = pPlayer->ProcessOutput( );
					if(!ret)
					{
						RemoveServer( i );
					}
				}
			}
		}
	}

	return true;
}