Esempio n. 1
0
void LLUpdaterServiceImpl::requiredUpdate(std::string const & newVersion,
										  LLURI const & uri,
										  std::string const & hash)
{
	stopTimer();
	mNewVersion = newVersion;
	mIsDownloading = true;
	setState(LLUpdaterService::DOWNLOADING);
	mUpdateDownloader.download(uri, hash, newVersion, true);
}
// A successful response was received from the viewer version manager
void LLUpdaterServiceImpl::response(LLSD const & content)
{
    if(!content.asBoolean()) // an empty response means "no update"
    {
        LL_INFOS("UpdaterService") << "up to date" << LL_ENDL;
        if(mIsChecking)
        {
            restartTimer(mCheckPeriod);
        }

        setState(LLUpdaterService::UP_TO_DATE);
    }
    else if ( content.isMap() && content.has("url") )
    {
        // there is an update available...
        stopTimer();
        mNewChannel = content["channel"].asString();
        if (mNewChannel.empty())
        {
            LL_INFOS("UpdaterService") << "no channel supplied, assuming current channel" << LL_ENDL;
            mNewChannel = mChannel;
        }
        mNewVersion = content["version"].asString();
        mIsDownloading = true;
        setState(LLUpdaterService::DOWNLOADING);
        BOOL required = content["required"].asBoolean();
        LLURI url(content["url"].asString());
        std::string more_info = content["more_info"].asString();
        LL_DEBUGS("UpdaterService")
                << "Starting download of "
                << ( required ? "required" : "optional" ) << " update"
                << " to channel '" << mNewChannel << "' version " << mNewVersion
                << " more info '" << more_info << "'"
                << LL_ENDL;
        mUpdateDownloader.download(url, content["hash"].asString(), mNewChannel, mNewVersion, more_info, required);
    }
    else
    {
        LL_WARNS("UpdaterService") << "Invalid update query response ignored; retry in "
                                   << mCheckPeriod << " seconds" << LL_ENDL;
        restartTimer(mCheckPeriod);
    }
}