diff options
author | Oz Linden <oz@lindenlab.com> | 2013-07-09 08:39:22 -0700 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-07-09 08:39:22 -0700 |
commit | 34c77159f7dea117eb69fe013b09f2719b12e612 (patch) | |
tree | 881783048f392ba88297a3c8dbdd7f3ef8195f4d /indra | |
parent | 6060e5e46acbeb20a301070a0fd0efea029d33d0 (diff) |
CHOP-963: Make update service query url depend on the grid rather than settings
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llappviewer.cpp | 16 | ||||
-rwxr-xr-x | indra/newview/llviewernetwork.cpp | 18 | ||||
-rwxr-xr-x | indra/newview/llviewernetwork.h | 9 | ||||
-rwxr-xr-x | indra/newview/tests/lllogininstance_test.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/tests/llviewernetwork_test.cpp | 10 | ||||
-rwxr-xr-x | indra/viewer_components/updater/llupdatechecker.cpp | 21 | ||||
-rwxr-xr-x | indra/viewer_components/updater/llupdatechecker.h | 12 | ||||
-rwxr-xr-x | indra/viewer_components/updater/llupdaterservice.cpp | 41 | ||||
-rwxr-xr-x | indra/viewer_components/updater/llupdaterservice.h | 4 | ||||
-rwxr-xr-x | indra/viewer_components/updater/tests/llupdaterservice_test.cpp | 24 |
10 files changed, 103 insertions, 57 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f92274dbbd..68775f2999 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3048,13 +3048,19 @@ namespace { void LLAppViewer::initUpdater() { // Initialize the updater service. - // Generate URL to the udpater service // Get Channel // Get Version - std::string url = gSavedSettings.getString("UpdaterServiceURL"); + + /***************************************************************** + * Previously, the url was derived from the settings + * UpdaterServiceURL + * UpdaterServicePath + * it is now obtained from the grid manager. The settings above + * are no longer used. + *****************************************************************/ std::string channel = LLVersionInfo::getChannel(); std::string version = LLVersionInfo::getVersion(); - std::string service_path = gSavedSettings.getString("UpdaterServicePath"); + U32 check_period = gSavedSettings.getU32("UpdaterServiceCheckPeriod"); bool willing_to_test; LL_DEBUGS("UpdaterService") << "channel " << channel << LL_ENDL; @@ -3079,9 +3085,7 @@ void LLAppViewer::initUpdater() } mUpdater->setAppExitCallback(boost::bind(&LLAppViewer::forceQuit, this)); - mUpdater->initialize(url, - service_path, - channel, + mUpdater->initialize(channel, version, gPlatform, getOSInfo().getOSVersionString(), diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index 97f4c3e5fe..371b00b173 100755 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -43,6 +43,8 @@ const std::string GRID_LABEL_VALUE = "label"; const std::string GRID_ID_VALUE = "grid_login_id"; /// the url for the login cgi script const std::string GRID_LOGIN_URI_VALUE = "login_uri"; +/// url base for update queries +const std::string GRID_UPDATE_SERVICE_URL = "update_query_url_base"; /// const std::string GRID_HELPER_URI_VALUE = "helper_uri"; /// the splash page url @@ -63,6 +65,8 @@ const std::string DEFAULT_LOGIN_PAGE = "http://viewer-login.agni.lindenlab.com/" const std::string MAIN_GRID_LOGIN_URI = "https://login.agni.lindenlab.com/cgi-bin/login.cgi"; +const std::string SL_UPDATE_QUERY_URL = "https://update.secondlife.com/update"; + const std::string MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/"; const std::string SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app"; @@ -120,12 +124,14 @@ void LLGridManager::initialize(const std::string& grid_file) MAIN_GRID_LOGIN_URI, "https://secondlife.com/helpers/", DEFAULT_LOGIN_PAGE, + SL_UPDATE_QUERY_URL, "Agni"); addSystemGrid("Second Life Beta Test Grid (Aditi)", "util.aditi.lindenlab.com", "https://login.aditi.lindenlab.com/cgi-bin/login.cgi", "http://aditi-secondlife.webdev.lindenlab.com/helpers/", DEFAULT_LOGIN_PAGE, + SL_UPDATE_QUERY_URL, "Aditi"); LLSD other_grids; @@ -332,6 +338,7 @@ void LLGridManager::addSystemGrid(const std::string& label, const std::string& login_uri, const std::string& helper, const std::string& login_page, + const std::string& update_url_base, const std::string& login_id) { LLSD grid = LLSD::emptyMap(); @@ -341,6 +348,7 @@ void LLGridManager::addSystemGrid(const std::string& label, grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray(); grid[GRID_LOGIN_URI_VALUE].append(login_uri); grid[GRID_LOGIN_PAGE_VALUE] = login_page; + grid[GRID_UPDATE_SERVICE_URL] = update_url_base; grid[GRID_IS_SYSTEM_GRID_VALUE] = true; grid[GRID_LOGIN_IDENTIFIER_TYPES] = LLSD::emptyArray(); grid[GRID_LOGIN_IDENTIFIER_TYPES].append(CRED_IDENTIFIER_TYPE_AGENT); @@ -537,6 +545,16 @@ std::string LLGridManager::getGridLoginID() return mGridList[mGrid][GRID_ID_VALUE]; } +std::string LLGridManager::getUpdateServiceURL() +{ + std::string update_url_base; + if ( mGridList[mGrid].has(GRID_UPDATE_SERVICE_URL) ) + { + update_url_base = mGridList[mGrid][GRID_UPDATE_SERVICE_URL].asString(); + } + return update_url_base; +} + void LLGridManager::updateIsInProductionGrid() { mIsInProductionGrid = false; diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h index 3f56103b2e..8526c0ba7f 100755 --- a/indra/newview/llviewernetwork.h +++ b/indra/newview/llviewernetwork.h @@ -140,6 +140,14 @@ class LLGridManager : public LLSingleton<LLGridManager> */ //@} + /* ================================================================ + * @name Update Related Properties + * @{ + */ + /// Get the update service URL base (host and path) for the selected grid + std::string getUpdateServiceURL(); + + //@} /* ================================================================ * @name URL Construction Properties @@ -207,6 +215,7 @@ class LLGridManager : public LLSingleton<LLGridManager> const std::string& login, const std::string& helper, const std::string& login_page, + const std::string& update_url_base, const std::string& login_id = ""); diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index f038112fd0..f004e03a2d 100755 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -135,6 +135,7 @@ void LLGridManager::addSystemGrid(const std::string& label, const std::string& login, const std::string& helper, const std::string& login_page, + const std::string& update_url_base, const std::string& login_id) { } @@ -208,9 +209,7 @@ std::string const & LLUpdaterService::pumpName(void) return wakka; } bool LLUpdaterService::updateReadyToInstall(void) { return false; } -void LLUpdaterService::initialize(const std::string& url, - const std::string& path, - const std::string& channel, +void LLUpdaterService::initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index a1e97ea17e..8ebfde580b 100755 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -127,6 +127,7 @@ const char *gSampleGridFile = " <array>" " <string>myloginuri</string>" " </array>" + " <key>update_query_url_base</key><string>https://update.secondlife.com/update</string>" " <key>keyname</key><string>util.foobar.lindenlab.com</string>" " </map>" " </map>" @@ -185,6 +186,9 @@ namespace tut ensure_equals("id for agni", std::string("Agni"), LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); ensure_equals("label for agni", LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), std::string("Second Life Main Grid (Agni)")); @@ -256,6 +260,9 @@ namespace tut ensure_equals("id for agni", LLGridManager::getInstance()->getGridId("util.agni.lindenlab.com"), std::string("Agni")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); ensure_equals("label for agni", LLGridManager::getInstance()->getGridLabel("util.agni.lindenlab.com"), std::string("Second Life Main Grid (Agni)")); @@ -384,6 +391,9 @@ namespace tut ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(), std::string("http://viewer-login.agni.lindenlab.com/")); + ensure_equals("update url base for Agni", // relies on agni being the default + std::string("https://update.secondlife.com/update"), + LLGridManager::getInstance()->getUpdateServiceURL()); ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid()); std::vector<std::string> uris; LLGridManager::getInstance()->getLoginURIs(uris); diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index 1e768f52d9..91a5f9246e 100755 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -62,8 +62,7 @@ LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client): } -void LLUpdateChecker::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -71,7 +70,7 @@ void LLUpdateChecker::checkVersion(std::string const & hostUrl, unsigned char uniqueid[MD5HEX_STR_SIZE], bool willing_to_test) { - mImplementation->checkVersion(hostUrl, servicePath, channel, version, platform, platform_version, uniqueid, willing_to_test); + mImplementation->checkVersion(urlBase, channel, version, platform, platform_version, uniqueid, willing_to_test); } @@ -99,8 +98,7 @@ LLUpdateChecker::Implementation::~Implementation() } -void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -112,8 +110,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, { mInProgress = true; - mHostUrl = hostUrl; - mServicePath = servicePath; + mUrlBase = urlBase; mChannel = channel; mVersion = version; mPlatform = platform; @@ -123,7 +120,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & hostUrl, mProtocol = sProtocolVersion; - std::string checkUrl = buildUrl(hostUrl, servicePath, channel, version, platform, platform_version, uniqueid, willing_to_test); + std::string checkUrl = buildUrl(urlBase, channel, version, platform, platform_version, uniqueid, willing_to_test); LL_INFOS("UpdaterService") << "checking for updates at " << checkUrl << LL_ENDL; mHttpClient.get(checkUrl, this); @@ -158,7 +155,7 @@ void LLUpdateChecker::Implementation::completed(U32 status, if (mProtocol == sProtocolVersion) { mProtocol = sLegacyProtocolVersion; - std::string retryUrl = buildUrl(mHostUrl, mServicePath, mChannel, mVersion, mPlatform, mPlatformVersion, mUniqueId, mWillingToTest); + std::string retryUrl = buildUrl(mUrlBase, mChannel, mVersion, mPlatform, mPlatformVersion, mUniqueId, mWillingToTest); LL_WARNS("UpdaterService") << "update response using " << sProtocolVersion @@ -203,8 +200,7 @@ void LLUpdateChecker::Implementation::error(U32 status, const std::string & reas } -std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUrl, - std::string const & servicePath, +std::string LLUpdateChecker::Implementation::buildUrl(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -213,7 +209,6 @@ std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUr bool willing_to_test) { LLSD path; - path.append(servicePath); path.append(mProtocol); path.append(channel); path.append(version); @@ -224,5 +219,5 @@ std::string LLUpdateChecker::Implementation::buildUrl(std::string const & hostUr path.append(willing_to_test ? "testok" : "testno"); path.append((char*)uniqueid); } - return LLURI::buildHTTP(hostUrl, path).asString(); + return LLURI::buildHTTP(urlBase, path).asString(); } diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index 8e85587490..4244007340 100755 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -43,8 +43,7 @@ public: public: Implementation(Client & client); ~Implementation(); - void checkVersion(std::string const & hostUrl, - std::string const & servicePath, + void checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -68,16 +67,14 @@ public: LLHTTPClient mHttpClient; bool mInProgress; std::string mVersion; - std::string mHostUrl; - std::string mServicePath; + std::string mUrlBase; std::string mChannel; std::string mPlatform; std::string mPlatformVersion; unsigned char mUniqueId[MD5HEX_STR_SIZE]; bool mWillingToTest; - std::string buildUrl(std::string const & hostUrl, - std::string const & servicePath, + std::string buildUrl(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -95,8 +92,7 @@ public: LLUpdateChecker(Client & client); // Check status of current app on the given host for the channel and version provided. - void checkVersion(std::string const & hostUrl, - std::string const & servicePath, + void checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index 1bd9fa4fc0..522c4a54b5 100755 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -38,6 +38,7 @@ #include "lldir.h" #include "llsdserialize.h" #include "llfile.h" +#include "llviewernetwork.h" #if LL_WINDOWS #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally @@ -93,8 +94,6 @@ class LLUpdaterServiceImpl : static const std::string sListenerName; std::string mProtocolVersion; - std::string mUrl; - std::string mPath; std::string mChannel; std::string mVersion; std::string mPlatform; @@ -120,9 +119,7 @@ public: LLUpdaterServiceImpl(); virtual ~LLUpdaterServiceImpl(); - void initialize(const std::string& url, - const std::string& path, - const std::string& channel, + void initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -183,9 +180,7 @@ LLUpdaterServiceImpl::~LLUpdaterServiceImpl() LLEventPumps::instance().obtain("mainloop").stopListening(sListenerName); } -void LLUpdaterServiceImpl::initialize(const std::string& url, - const std::string& path, - const std::string& channel, +void LLUpdaterServiceImpl::initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -198,8 +193,6 @@ void LLUpdaterServiceImpl::initialize(const std::string& url, "while updater is running."); } - mUrl = url; - mPath = path; mChannel = channel; mVersion = version; mPlatform = platform; @@ -207,8 +200,6 @@ void LLUpdaterServiceImpl::initialize(const std::string& url, memcpy(mUniqueId, uniqueid, MD5HEX_STR_SIZE); mWillingToTest = willing_to_test; LL_DEBUGS("UpdaterService") - << "\n url: " << mUrl - << "\n path: " << mPath << "\n channel: " << mChannel << "\n version: " << mVersion << "\n uniqueid: " << mUniqueId @@ -228,7 +219,7 @@ void LLUpdaterServiceImpl::setBandwidthLimit(U64 bytesPerSecond) void LLUpdaterServiceImpl::startChecking(bool install_if_ready) { - if(mUrl.empty() || mChannel.empty() || mVersion.empty()) + if(mChannel.empty() || mVersion.empty()) { throw LLUpdaterService::UsageError("Set params before call to " "LLUpdaterService::startCheck()."); @@ -565,8 +556,22 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event) } else { - mUpdateChecker.checkVersion(mUrl, mPath, mChannel, mVersion, mPlatform, mPlatformVersion, mUniqueId, mWillingToTest); - setState(LLUpdaterService::CHECKING_FOR_UPDATE); + std::string query_url = LLGridManager::getInstance()->getUpdateServiceURL(); + if ( !query_url.empty() ) + { + mUpdateChecker.checkVersion(query_url, mChannel, mVersion, + mPlatform, mPlatformVersion, mUniqueId, + mWillingToTest); + setState(LLUpdaterService::CHECKING_FOR_UPDATE); + } + else + { + LL_WARNS("UpdaterService") + << "No updater service defined for grid '" << LLGridManager::getInstance()->getGrid() + << "' will check again in " << mCheckPeriod << " seconds" + << LL_ENDL; + restartTimer(mCheckPeriod); + } } } else @@ -610,9 +615,7 @@ LLUpdaterService::~LLUpdaterService() { } -void LLUpdaterService::initialize(const std::string& url, - const std::string& path, - const std::string& channel, +void LLUpdaterService::initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, @@ -620,7 +623,7 @@ void LLUpdaterService::initialize(const std::string& url, const bool& willing_to_test ) { - mImpl->initialize(url, path, channel, version, platform, platform_version, uniqueid, willing_to_test); + mImpl->initialize(channel, version, platform, platform_version, uniqueid, willing_to_test); } void LLUpdaterService::setCheckPeriod(unsigned int seconds) diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h index 982f99b861..0ddf24935b 100755 --- a/indra/viewer_components/updater/llupdaterservice.h +++ b/indra/viewer_components/updater/llupdaterservice.h @@ -71,9 +71,7 @@ public: LLUpdaterService(); ~LLUpdaterService(); - void initialize(const std::string& url, - const std::string& path, - const std::string& channel, + void initialize(const std::string& channel, const std::string& version, const std::string& platform, const std::string& platform_version, diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp index 4812272ebc..759e41ef4c 100755 --- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp +++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp @@ -44,8 +44,7 @@ *****************************************************************************/ LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client) {} -void LLUpdateChecker::checkVersion(std::string const & hostUrl, - std::string const & servicePath, +void LLUpdateChecker::checkVersion(std::string const & urlBase, std::string const & channel, std::string const & version, std::string const & platform, @@ -91,6 +90,21 @@ bool LLDir::setCacheDir(const std::string &path){ return true; } void LLDir::dumpCurrentDirectories() {} void LLDir::updatePerAccountChatLogsDir() {} +#include "llviewernetwork.h" +LLGridManager::LLGridManager() : + mGrid("test.grid.lindenlab.com"), + mIsInProductionGrid(false) +{ +} +std::string LLGridManager::getUpdateServiceURL() +{ + return "https://update.secondlife.com/update"; +} +LLGridManager::~LLGridManager() +{ +} + + std::string LLDir::getExpandedFilename(ELLPath location, const std::string &filename) const { @@ -179,10 +193,10 @@ namespace tut try { unsigned char id1[MD5HEX_STR_SIZE] = "11111111111111111111111111111111"; - updater.initialize(test_url, "update" ,test_channel, test_version, "win", "1.2.3", id1, true); + updater.initialize(test_channel, test_version, "win", "1.2.3", id1, true); updater.startChecking(); unsigned char id2[MD5HEX_STR_SIZE] = "22222222222222222222222222222222"; - updater.initialize("other_url", "update", test_channel, test_version, "win", "4.5.6", id2, true); + updater.initialize(test_channel, test_version, "win", "4.5.6", id2, true); } catch(LLUpdaterService::UsageError) { @@ -197,7 +211,7 @@ namespace tut DEBUG; LLUpdaterService updater; unsigned char id[MD5HEX_STR_SIZE] = "33333333333333333333333333333333"; - updater.initialize(test_url, "update", test_channel, test_version, "win", "7.8.9", id, true); + updater.initialize(test_channel, test_version, "win", "7.8.9", id, true); updater.startChecking(); ensure(updater.isChecking()); updater.stopChecking(); |