summaryrefslogtreecommitdiff
path: root/indra/viewer_components/updater
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2010-11-17 16:27:50 -0800
committerAndrew A. de Laix <alain@lindenlab.com>2010-11-17 16:27:50 -0800
commitc212695cd96f94248b0da2085aeb23c54a5ca76b (patch)
tree3efd8a99bf4addaf53ca66ba8428ac489a9ea4a9 /indra/viewer_components/updater
parent8e0e5e0bd9fd3e699a36b6babfacab3c0f61935b (diff)
post events for dowload success and error.
Diffstat (limited to 'indra/viewer_components/updater')
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp24
-rw-r--r--indra/viewer_components/updater/llupdaterservice.h10
2 files changed, 33 insertions, 1 deletions
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 976e639098..6a40246497 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -135,7 +135,7 @@ public:
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())
diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h
index ec20dc6e05..8d0b95be86 100644
--- a/indra/viewer_components/updater/llupdaterservice.h
+++ b/indra/viewer_components/updater/llupdaterservice.h
@@ -39,6 +39,16 @@ public:
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();