Ejemplo n.º 1
0
///////////////////////////////////////////////////////////////
//
// CNetBufferWatchDog::DoChecks
//
// Thread:                  check
// Mutex should be locked:  yes
//
///////////////////////////////////////////////////////////////
void CNetBufferWatchDog::DoChecks ( void )
{
    // Get queue sizes now
    uint uiFinishedList;
    uint uiOutCommandQueue;
    uint uiOutResultQueue;
    uint uiInResultQueue;
    m_pNetBuffer->GetQueueSizes ( uiFinishedList, uiOutCommandQueue, uiOutResultQueue, uiInResultQueue, m_uiGamePlayerCount );

    // Update queue status
    UpdateQueueInfo ( m_FinishedListQueueInfo, uiFinishedList, "[Network] FinishedList" );
    UpdateQueueInfo ( m_OutCommandQueueInfo, uiOutCommandQueue, "[Network] OutCommandQueue" );
    UpdateQueueInfo ( m_OutResultQueueInfo, uiOutResultQueue, "[Network] OutResultQueue" );
    UpdateQueueInfo ( m_InResultQueueInfo, uiInResultQueue, "[Network] InResultQueue" );

    // Apply queue status
    if ( m_OutCommandQueueInfo.status == EQueueStatus::STATUS_OK )
        AllowOutgoingSyncPackets ();
    else
    if ( m_OutCommandQueueInfo.status == EQueueStatus::SUSPEND_SYNC )
        BlockOutgoingSyncPackets ();

    if ( m_InResultQueueInfo.status == EQueueStatus::STATUS_OK )
        AllowIncomingSyncPackets ();
    else
    if ( m_OutCommandQueueInfo.status == EQueueStatus::SUSPEND_SYNC )
        BlockIncomingSyncPackets ();

    // Copy sizes for stats only (Unsafe)
    ms_uiFinishedListSize = uiFinishedList;
    ms_uiOutCommandQueueSize = uiOutCommandQueue;
    ms_uiOutResultQueueSize = uiOutResultQueue;
    ms_uiInResultQueueSize = uiInResultQueue;
}
Ejemplo n.º 2
0
///////////////////////////////////////////////////////////////
//
// CNetBufferWatchDog::DoChecks
//
// Thread:                  check
// Mutex should be locked:  yes
//
///////////////////////////////////////////////////////////////
void CNetBufferWatchDog::DoChecks ( void )
{
    // Check when main thread last updated anything
    CheckActionHistory ( g_HistorySet.main, "Main", m_uiMainAgeHigh );
    CheckActionHistory ( g_HistorySet.sync, "Sync", m_uiSyncAgeHigh );

    // Get queue sizes now
    uint uiFinishedList;
    uint uiOutCommandQueue;
    uint uiOutResultQueue;
    uint uiInResultQueue;
    m_pNetBuffer->GetQueueSizes ( uiFinishedList, uiOutCommandQueue, uiOutResultQueue, uiInResultQueue );

    // Update queue status
    UpdateQueueInfo ( m_FinishedListQueueInfo, uiFinishedList, "FinishedList" );
    UpdateQueueInfo ( m_OutCommandQueueInfo, uiOutCommandQueue, "OutCommandQueue" );
    UpdateQueueInfo ( m_OutResultQueueInfo, uiOutResultQueue, "OutResultQueue" );
    UpdateQueueInfo ( m_InResultQueueInfo, uiInResultQueue, "InResultQueue" );

    // Apply queue status
    if ( m_OutCommandQueueInfo.status == EQueueStatus::STATUS_OK )
        AllowOutgoingSyncPackets ();
    else
    if ( m_OutCommandQueueInfo.status == EQueueStatus::SUSPEND_SYNC )
        BlockOutgoingSyncPackets ();

    if ( m_InResultQueueInfo.status == EQueueStatus::STATUS_OK )
        AllowIncomingSyncPackets ();
    else
    if ( m_OutCommandQueueInfo.status == EQueueStatus::SUSPEND_SYNC )
        BlockIncomingSyncPackets ();
}