Exemplo n.º 1
0
DWORD
CdcDisableClientAffinity(
    VOID
    )
{
    DWORD dwError = 0;

    BOOL bIsLocked = FALSE;

    VMAFD_LOCK_MUTEX(bIsLocked,&mutexStateChange);

    dwError = CdcPurgeCache();
    BAIL_ON_VMAFD_ERROR(dwError);

    dwError = CdcDbSetHAClientState(CDC_DC_STATE_DISABLED);
    BAIL_ON_VMAFD_ERROR(dwError);

    dwError = CdcRegDbSetHAMode(FALSE);
    BAIL_ON_VMAFD_ERROR(dwError);

cleanup:

    VMAFD_UNLOCK_MUTEX(bIsLocked,&mutexStateChange);
    return dwError;

error:
    goto cleanup;
}
Exemplo n.º 2
0
DWORD
CdcEnableClientAffinity(
    VOID
    )
{
    DWORD dwError = 0;
    BOOL bIsLocked = 0;
    BOOL bEnabledHA = FALSE;

    dwError = CdcRegDbGetHAMode(&bEnabledHA);
    BAIL_ON_VMAFD_ERROR(dwError);

    if (!bEnabledHA)
    {
        VMAFD_LOCK_MUTEX(bIsLocked,&mutexStateChange);

        dwError = CdcDbSetHAClientState(CDC_DC_STATE_NO_DC_LIST);
        BAIL_ON_VMAFD_ERROR(dwError);

        dwError = CdcRegDbSetHAMode(TRUE);
        BAIL_ON_VMAFD_ERROR(dwError);

        VMAFD_UNLOCK_MUTEX(bIsLocked,&mutexStateChange);
    }

    dwError = CdcWakeupDCCachingThread(
                                  gVmafdGlobals.pDCCacheThr,
                                  TRUE
                                  );
    if (dwError)
    {
        VmAfdLog (VMAFD_DEBUG_ANY,
                  "Failed to wake up DC Caching thread: %d",
                  dwError
                 );
        dwError = 0;
    }

cleanup:

    VMAFD_UNLOCK_MUTEX(bIsLocked,&mutexStateChange);
    return dwError;

error:
    goto cleanup;
}
Exemplo n.º 3
0
DWORD
CdcSrvEnableDefaultHA(
    PCDC_CONTEXT pCdcContext
    )
{
    DWORD dwError = 0;
    CDC_DB_ENUM_HA_MODE cdcHAMode = CDC_DB_ENUM_HA_MODE_UNDEFINED;
    BOOL bIsLocked  = FALSE;

    if (!pCdcContext)
    {
        dwError = ERROR_INVALID_PARAMETER;
        BAIL_ON_VMAFD_ERROR(dwError);
    }

    dwError = CdcRegDbGetHAMode(&cdcHAMode);
    BAIL_ON_VMAFD_ERROR(dwError);

    if (cdcHAMode != CDC_DB_ENUM_HA_MODE_DEFAULT)
    {
        VMAFD_LOCK_MUTEX(bIsLocked, &pCdcContext->context_mutex);

        dwError = CdcRegDbSetHAMode(CDC_DB_ENUM_HA_MODE_DEFAULT);
        BAIL_ON_VMAFD_ERROR(dwError);

        VMAFD_UNLOCK_MUTEX(bIsLocked, &pCdcContext->context_mutex);
    }

    dwError = CdcSrvInitDefaultHAMode(pCdcContext);
    BAIL_ON_VMAFD_ERROR(dwError);


cleanup:

    if (pCdcContext)
    {
        VMAFD_UNLOCK_MUTEX(bIsLocked, &pCdcContext->context_mutex);
    }
    return dwError;

error:
    goto cleanup;
}
Exemplo n.º 4
0
DWORD
CdcSrvEnableLegacyModeHA(
    PCDC_CONTEXT pCdcContext
    )
{
    DWORD dwError = 0;
    BOOL  bIsLocked = FALSE;

    if (!pCdcContext)
    {
        dwError = ERROR_INVALID_PARAMETER;
        VmAfdLog(
              VMAFD_DEBUG_ERROR,
              "Invalid state machine context received"
              );
        BAIL_ON_VMAFD_ERROR(dwError);
    }

    VMAFD_LOCK_MUTEX(bIsLocked, &pCdcContext->context_mutex);

    dwError = CdcRegDbSetHAMode(CDC_DB_ENUM_HA_MODE_LEGACY);
    BAIL_ON_VMAFD_ERROR(dwError);

    dwError = CdcSrvShutdownDefaultHAMode(pCdcContext);
    BAIL_ON_VMAFD_ERROR(dwError);

    VMAFD_UNLOCK_MUTEX(bIsLocked, &pCdcContext->context_mutex);

cleanup:

    if (pCdcContext)
    {
        VMAFD_UNLOCK_MUTEX(bIsLocked,&pCdcContext->context_mutex);
    }
    return dwError;

error:
    goto cleanup;
}