void client::DisableClientAffinity() { DWORD dwError = 0; //This code would eventually move out of here //when other APIs become remotable PVMAFD_SERVER pServer = NULL; dwError = VmAfdOpenServerA(NULL,NULL,NULL,&pServer); BAIL_ON_ERROR(dwError); dwError = CdcDisableClientAffinity(pServer); BAIL_ON_ERROR(dwError); cleanup: if (pServer) { VmAfdCloseServer(pServer); } return; error: THROW_IF_NEEDED(dwError); goto cleanup; }
JNIEXPORT jint JNICALL Java_com_vmware_identity_cdc_CdcAdapter_CdcDisableClientAffinity( JNIEnv *env, jobject clazz, jobject jpServer ) { DWORD dwError = 0; PVMAFD_SERVER pServer = NULL; if (jpServer == NULL) { dwError = ERROR_INVALID_PARAMETER; BAIL_ON_ERROR(dwError); } dwError = JniGetPointer(env, jpServer, (PVOID*)&pServer); BAIL_ON_ERROR(dwError); dwError = CdcDisableClientAffinity( pServer ); BAIL_ON_ERROR(dwError); cleanup: return dwError; error: goto cleanup; }
DWORD CdcRunStateMachine( BOOLEAN bPurgeRefresh ) { DWORD dwError = 0; BOOL bHAEnabled = FALSE; CDC_DC_STATE cdcCurrentState = CDC_DC_STATE_UNDEFINED; dwError = CdcSrvGetCurrentState(&cdcCurrentState); BAIL_ON_VMAFD_ERROR(dwError); dwError = CdcDbGetHAClientState(&bHAEnabled); BAIL_ON_VMAFD_ERROR(dwError); if (bHAEnabled) { switch (cdcCurrentState) { case CDC_DC_STATE_DISABLED: dwError = CdcDisableClientAffinity(); break; case CDC_DC_STATE_NO_DC_LIST: dwError = CdcHandleNoDCList(); break; case CDC_DC_STATE_SITE_AFFINITIZED: dwError = CdcUpdateCache(bPurgeRefresh); BAIL_ON_VMAFD_ERROR(dwError); dwError = CdcHandleSiteAffinitized(); break; case CDC_DC_STATE_OFF_SITE: dwError = CdcUpdateCache(bPurgeRefresh); BAIL_ON_VMAFD_ERROR(dwError); CdcHandleOffSite(); break; case CDC_DC_STATE_NO_DCS_ALIVE: dwError = CdcUpdateCache(FALSE); BAIL_ON_VMAFD_ERROR(dwError); CdcHandleNoDCsAlive(); break; default: dwError = ERROR_INVALID_STATE; break; } BAIL_ON_VMAFD_ERROR(dwError); } cleanup: return dwError; error: goto cleanup; }