bool LoginPlayerManager::ProcessOutputs( ) { __ENTER_FUNCTION bool ret = false ; if (m_MinFD == INVALID_SOCKET && m_MaxFD == INVALID_SOCKET) // no player exist { return true ; } //数据发送 uint32_t nPlayerCount = GetPlayerNumber() ; for( uint32_t i=0; i<nPlayerCount; i++ ) { if( m_pPlayers[i]==INVALID_ID ) continue ; LoginPlayer* pPlayer = g_pPlayerPool->GetPlayer(m_pPlayers[i]) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket().getSOCKET() ; if( s == m_SocketID ) continue ; if( FD_ISSET( s, &m_WriteFDs[SELECT_USE] ) ) { if( pPlayer->GetSocket().isSockError() ) {//连接出现错误 RemovePlayer( pPlayer ) ; } else {//连接正常 _MY_TRY { ret = pPlayer->ProcessOutput( ) ; if( !ret ) { RemovePlayer( pPlayer ) ; } } _MY_CATCH { RemovePlayer( pPlayer ) ; } } } } return true ; __LEAVE_FUNCTION return false ; }
BOOL LoginPlayerManager::ProcessOutputs() { __ENTER_FUNCTION BOOL ret = FALSE ; if ( INVALID_SOCKET == m_MinFD && INVALID_SOCKET == m_MaxFD ) // no player exist { return TRUE ; } //数据发送 UINT nPlayerCount = GetPlayerNumber() ; for ( UINT i=0 ; i<nPlayerCount ; i++ ) { if ( INVALID_ID == m_pPlayers[ i ] ) continue ; LoginPlayer* pPlayer = g_pPlayerPool->GetPlayer( m_pPlayers[ i ] ) ; Assert( pPlayer ) ; SOCKET s = pPlayer->GetSocket()->getSOCKET() ; if ( s == m_SocketID ) continue ; if ( FD_ISSET( s, &m_WriteFDs[ SELECT_USE ] ) ) { if( pPlayer->GetSocket()->isSockError() ) {//连接出现错误 RemovePlayer( pPlayer ) ; } else {//连接正常 _MY_TRY { ret = pPlayer->ProcessOutput() ; if ( !ret ) { RemovePlayer( pPlayer ) ; } } _MY_CATCH { RemovePlayer( pPlayer ) ; } } } } return TRUE ; __LEAVE_FUNCTION return FALSE ; }