Ejemplo n.º 1
0
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
	if(mTimer.getStarted() && mTimer.hasExpired())
	{
		stopTimer();

		// Check for failed install.
		if(LLFile::isfile(ll_install_failed_marker_path()))
		{
			int requiredValue = 0; 
			{
				llifstream stream(ll_install_failed_marker_path());
				stream >> requiredValue;
				if(stream.fail()) requiredValue = 0;
			}
			// TODO: notify the user.
			llinfos << "found marker " << ll_install_failed_marker_path() << llendl;
			llinfos << "last install attempt failed" << llendl;
			LLFile::remove(ll_install_failed_marker_path());
			
			LLSD event;
			event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
			event["required"] = LLSD(requiredValue);
			LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);
			
			setState(LLUpdaterService::TERMINAL);
		}
		else
		{
bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
{
    if(mTimer.getStarted() && mTimer.hasExpired())
    {
        stopTimer();

        // Check for failed install.
        if(LLFile::isfile(ll_install_failed_marker_path()))
        {
            LL_DEBUGS("UpdaterService") << "found marker " << ll_install_failed_marker_path() << LL_ENDL;
            int requiredValue = 0;
            {
                llifstream stream(ll_install_failed_marker_path().c_str());
                stream >> requiredValue;
                if(stream.fail())
                {
                    requiredValue = 0;
                }
            }
            // TODO: notify the user.
            LL_WARNS("UpdaterService") << "last install attempt failed" << LL_ENDL;;
            LLFile::remove(ll_install_failed_marker_path());

            LLSD event;
            event["type"] = LLSD(LLUpdaterService::INSTALL_ERROR);
            event["required"] = LLSD(requiredValue);
            LLEventPumps::instance().obtain(LLUpdaterService::pumpName()).post(event);

            setState(LLUpdaterService::TERMINAL);
        }
        //<FS:TM> 3.6.4 check this, commented out to compile
        //else
        //{
        //	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;
        //		// Because the grid can be changed after the viewer is started (when the first check takes place)
        //		// but before the user logs in, the next check may be on a different grid, so set the retry timer
        //		// even though this check did not happen.  The default time is once an hour, and if we're not
        //		// doing the check anyway the performance impact is completely insignificant.
        //		restartTimer(mCheckPeriod);
        //	}
        //}
    }