summaryrefslogtreecommitdiff
path: root/indra/newview/llmutelist.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmutelist.h')
-rw-r--r--indra/newview/llmutelist.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h
index b65fd61fcc..2781e9b177 100644
--- a/indra/newview/llmutelist.h
+++ b/indra/newview/llmutelist.h
@@ -31,6 +31,8 @@
#include "lluuid.h"
#include "llextendedstatus.h"
+#include <boost/signals2/connection.hpp>
+
class LLViewerObject;
class LLMessageSystem;
class LLMuteListObserver;
@@ -82,6 +84,15 @@ class LLMuteList : public LLSingleton<LLMuteList>
ML_LOADED,
ML_FAILED,
};
+
+ enum EMuteListSource
+ {
+ MLS_NONE,
+ MLS_SERVER,
+ MLS_SERVER_EMPTY,
+ MLS_SERVER_CACHE,
+ MLS_FALLBACK_CACHE,
+ };
public:
// reasons for auto-unmuting a resident
enum EAutoReason
@@ -115,8 +126,17 @@ public:
static bool isLinden(const std::string& name);
- bool isLoaded() const { return mLoadState == ML_LOADED; }
- bool getLoadFailed() const;
+ // Load state accessors.
+ bool isLoaded() const { return mLoadState == ML_LOADED; } // Loaded, but not necessarily from server.
+ bool isFailed() const { return mLoadState == ML_FAILED; } // Unable to load any mute list. Server did not reply.
+ // Loaded from server, which is the only source we consider authoritative.
+ bool isLoadedFromServer() const { return isLoaded() && (mLoadSource == MLS_SERVER || mLoadSource == MLS_SERVER_EMPTY); }
+ // Loaded, but from cache. Would be nice to upgrade to a server load from here if possible.
+ bool isLoadedDegraded() const { return isLoaded() && !isLoadedFromServer(); }
+
+ // Advance the load state machine, trying cache fallback if necessary.
+ // Return value indicates mute list consumption readiness.
+ bool updateLoadState();
std::vector<LLMute> getMutes() const;
@@ -126,11 +146,19 @@ public:
// call this method on logout to save everything.
void cache(const LLUUID& agent_id);
+ // Handler for region change event, used for server request retries if isLoadedDegraded() is true
+ void onRegionChanged();
+
private:
- bool loadFromFile(const std::string& filename);
+ void clearCachedMutes();
+ bool loadFromFile(const std::string& filename, EMuteListSource source);
bool saveToFile(const std::string& filename);
+ bool tryLoadCacheFallback(const LLUUID& agent_id, const std::string& reason);
+ void setFailed(const std::string& reason);
+ static const char* sourceToString(EMuteListSource source);
+ std::string getCacheFilename(const LLUUID& agent_id) const;
- void setLoaded();
+ void setLoaded(EMuteListSource source);
void notifyObservers();
void notifyObserversDetailed(const LLMute &mute);
@@ -177,7 +205,11 @@ private:
observer_set_t mObservers;
EMuteListState mLoadState;
+ EMuteListSource mLoadSource;
F64 mRequestStartTime;
+ bool mTriedCacheFallback;
+ bool mTriedRegionChangeRetry;
+ boost::signals2::connection mRegionChangedCallback;
friend class LLDispatchEmptyMuteList;
};