Skip to content
Snippets Groups Projects
Commit c212695c authored by Andrew A. de Laix's avatar Andrew A. de Laix
Browse files

post events for dowload success and error.

parent 8e0e5e0b
No related branches found
No related tags found
No related merge requests found
......@@ -135,7 +135,7 @@ class LLUpdaterServiceImpl :
void downloadComplete(LLSD const & data);
void downloadError(std::string const & message);
bool onMainLoop(LLSD const & event);
bool onMainLoop(LLSD const & event);
private:
void restartTimer(unsigned int seconds);
......@@ -349,6 +349,13 @@ void LLUpdaterServiceImpl::downloadComplete(LLSD const & data)
// marker file.
llofstream update_marker(update_marker_path());
LLSDSerialize::toPrettyXML(data, update_marker);
LLSD event;
event["pump"] = LLUpdaterService::pumpName();
LLSD payload;
payload["type"] = LLSD(LLUpdaterService::DOWNLOAD_COMPLETE);
event["payload"] = payload;
LLEventPumps::instance().obtain("mainlooprepeater").post(event);
}
void LLUpdaterServiceImpl::downloadError(std::string const & message)
......@@ -362,6 +369,14 @@ void LLUpdaterServiceImpl::downloadError(std::string const & message)
{
restartTimer(mCheckPeriod);
}
LLSD event;
event["pump"] = LLUpdaterService::pumpName();
LLSD payload;
payload["type"] = LLSD(LLUpdaterService::DOWNLOAD_ERROR);
payload["message"] = message;
event["payload"] = payload;
LLEventPumps::instance().obtain("mainlooprepeater").post(event);
}
void LLUpdaterServiceImpl::restartTimer(unsigned int seconds)
......@@ -405,6 +420,13 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
//-----------------------------------------------------------------------
// Facade interface
std::string const & LLUpdaterService::pumpName(void)
{
static std::string name("updater_service");
return name;
}
LLUpdaterService::LLUpdaterService()
{
if(gUpdater.expired())
......
......@@ -39,6 +39,16 @@ class LLUpdaterService
public:
UsageError(const std::string& msg) : std::runtime_error(msg) {}
};
// Name of the event pump through which update events will be delivered.
static std::string const & pumpName(void);
// Type codes for events posted by this service. Stored the event's 'type' element.
enum UpdateEvent {
INVALID,
DOWNLOAD_COMPLETE,
DOWNLOAD_ERROR
};
LLUpdaterService();
~LLUpdaterService();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment