diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llmessageconfig.cpp | 25 | ||||
-rw-r--r-- | indra/llmessage/llmessageconfig.h | 1 | ||||
-rw-r--r-- | indra/test/llmessageconfig_tut.cpp | 17 |
3 files changed, 42 insertions, 1 deletions
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp index 550071fade..ed51019a22 100644 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -66,6 +66,7 @@ public: /* virtual */ void loadFile(); void loadServerDefaults(const LLSD& data); + void loadMaxQueuedEvents(const LLSD& data); void loadMessages(const LLSD& data); void loadCapBans(const LLSD& blacklist); void loadMessageBans(const LLSD& blacklist); @@ -73,6 +74,7 @@ public: public: LLSD mCapBans; + S32 mMaxQueuedEvents; }; std::string LLMessageConfigFile::filename() @@ -112,6 +114,7 @@ void LLMessageConfigFile::loadFile() } } loadServerDefaults(data); + loadMaxQueuedEvents(data); loadMessages(data); loadCapBans(data); loadMessageBans(data); @@ -122,6 +125,19 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data) mServerDefault = data["serverDefaults"][sServerName].asString(); } +const S32 DEFAULT_MAX_QUEUED_EVENTS = 100; +void LLMessageConfigFile::loadMaxQueuedEvents(const LLSD& data) +{ + if (data.has("maxQueuedEvents")) + { + mMaxQueuedEvents = data["maxQueuedEvents"].asInteger(); + } + else + { + mMaxQueuedEvents = DEFAULT_MAX_QUEUED_EVENTS; + } +} + void LLMessageConfigFile::loadMessages(const LLSD& data) { mMessages = data["messages"]; @@ -191,10 +207,10 @@ void LLMessageConfig::useConfig(const LLSD& config) { LLMessageConfigFile &the_file = LLMessageConfigFile::instance(); the_file.loadServerDefaults(config); + the_file.loadMaxQueuedEvents(config); the_file.loadMessages(config); the_file.loadCapBans(config); the_file.loadMessageBans(config); - } //static @@ -213,6 +229,13 @@ LLMessageConfig::Flavor LLMessageConfig::getServerDefaultFlavor() } //static +S32 LLMessageConfig::getMaxQueuedEvents() +{ + LLMessageConfigFile& file = LLMessageConfigFile::instance(); + return file.mMaxQueuedEvents; +} + +//static LLMessageConfig::Flavor LLMessageConfig::getMessageFlavor(const std::string& msg_name) { LLMessageConfigFile& file = LLMessageConfigFile::instance(); diff --git a/indra/llmessage/llmessageconfig.h b/indra/llmessage/llmessageconfig.h index 6814089b05..d694286569 100644 --- a/indra/llmessage/llmessageconfig.h +++ b/indra/llmessage/llmessageconfig.h @@ -48,6 +48,7 @@ public: static void useConfig(const LLSD& config); static Flavor getServerDefaultFlavor(); + static S32 getMaxQueuedEvents(); // For individual messages static Flavor getMessageFlavor(const std::string& msg_name); diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp index 086dbf4ef8..c2329220e5 100644 --- a/indra/test/llmessageconfig_tut.cpp +++ b/indra/test/llmessageconfig_tut.cpp @@ -221,4 +221,21 @@ namespace tut LLMessageConfig::onlySendLatest("msg2"), false); } + + template<> template<> + void LLMessageConfigTestObject::test<9>() + // tests that event queue max is reloaded + { + LLSD config; + config["maxQueuedEvents"] = 200; + LLMessageConfig::useConfig(config); + ensure_equals("Ensure setting maxQueuedEvents", + LLMessageConfig::getMaxQueuedEvents(), + 200); + + LLMessageConfig::useConfig(LLSD()); + ensure_equals("Ensure default of event queue max 100", + LLMessageConfig::getMaxQueuedEvents(), + 100); + } } |