diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2008-04-10 17:43:25 +0000 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2008-04-10 17:43:25 +0000 |
commit | acc8ae40cdb2f57969ab57e1e8e6ec505a50d02b (patch) | |
tree | a996eb45ed4250bbf3575c8b0c19e568eb2e5c50 /indra | |
parent | 3f08a67dc62ab88ced6baae18dae6b8818de6ced (diff) |
svn merge -r84490:84497 svn+ssh://svn/svn/linden/branches/DEV-11812-3
QAR-433 make max queued size on event queue configurable
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); + } } |