static void SPAuthCheck_DNSCompletion(AsyncOp *theOp, SPAuthCheckPrv *theCheck) { if(!theOp->Succeeded()) { theCheck->mStatus = theOp->GetStatus(); return; } // Step 2, AuthServer lookup ServerContextPtr aDirServers = new ServerContext; WONTypes::StringList::iterator anItr; for(anItr = theCheck->mDirServers.begin(); anItr != theCheck->mDirServers.end(); ++anItr) aDirServers->AddAddress(*anItr); GetMultiDirOpPtr anOp = new GetMultiDirOp(aDirServers); anOp->SetFlags(DIR_GF_DECOMPSERVICES | DIR_GF_SERVADDNETADDR); anOp->AddPath(L"/TitanServers/Auth"); anOp->SetFlags(DIR_GF_DECOMPROOT | DIR_GF_ADDDODATA); if(theCheck->mCDKey.IsForceCheck()) anOp->AddDataType("_SPF"); else anOp->AddDataType("_SP"); anOp->AddPath(theCheck->mProductDir); SPAuthCheck_RunOp(anOp,theCheck,SPAuthCheck_GetDirCompletion); }
void WONVerifyVersion(const char *pVersion, const char *pRegion) { if (!pVersion || !pVersion[0]) g_pLTCSBase->CPrint("You need to provide a version number."); bool bSuccess = true; WONStatus nResult; GetDirOpPtr cGetDir = new GetDirOp(WONGetCurrentServerContext(g_lWONServerList)); cGetDir->SetPath(L"/" + g_sWONCommunity + L"/Patch"); cGetDir->SetFlags( DIR_GF_DECOMPSERVICES | DIR_GF_SERVADDNETADDR); nResult = cGetDir->Run(OP_MODE_BLOCK, OP_TIMEOUT_INFINITE); bSuccess &= (nResult == WS_Success); if (bSuccess) { bSuccess &= !cGetDir->GetDirEntityList().empty(); } if (!bSuccess) { g_pLTCSBase->CPrint("Unable to query patch server: %s", WONStatusToString(nResult)); return; } ServerContextPtr cServerContext = new ServerContext; cServerContext->AddAddressesFromDir(cGetDir->GetDirEntityList()); CheckValidVersionOpPtr pVersionOp = new CheckValidVersionOp(g_sWONProduct, cServerContext); pVersionOp->SetVersion(pVersion); pVersionOp->SetConfigName(pRegion); pVersionOp->SetGetPatchList(false); nResult = pVersionOp->Run(OP_MODE_BLOCK, OP_TIMEOUT_INFINITE); bSuccess &= (nResult == WS_Success); if (!bSuccess) { switch (nResult) { case WS_DBProxyServ_OutOfDate : case WS_DBProxyServ_ValidNotLatest : g_pLTCSBase->CPrint("Version is out of date, and there's an update available: %s", WONStatusToString(nResult)); break; case WS_DBProxyServ_OutOfDateNoUpdate : g_pLTCSBase->CPrint("Version is out of date, no updates available: %s", WONStatusToString(nResult)); break; default : g_pLTCSBase->CPrint("Unable to retrieve version info: %s", WONStatusToString(nResult)); break; } return; } g_pLTCSBase->CPrint("That version is the current, valid version"); return; }
ServerContextPtr WONGetCurrentServerContext(const TWONServerList &lServers) { // Get the server list ServerContextPtr cDirContext = new ServerContext; TWONServerList::const_iterator iCurDirServer = lServers.begin(); for (; iCurDirServer != g_lWONServerList.end(); ++iCurDirServer) { cDirContext->AddAddress(IPAddr(*iCurDirServer)); } return cDirContext; }
ServerContextPtr MultiPingOp::GetServerContext(bool discardNonResponsiveServers) { ServerContextPtr aContext = new ServerContext; MultiPingList::iterator anItr = mFinishedList.begin(); while(anItr!=mFinishedList.end()) { MultiPingStruct *aStruct = *anItr; if(aStruct->mPingTime!=-1 || !discardNonResponsiveServers) aContext->AddAddress(aStruct->mAddr); ++anItr; } aContext->SetNeedShuffle(false); return aContext; }