From 2b5faa0b9cac3736b9d96a68cd13e05ee39ab7d1 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Mon, 9 Nov 2009 13:12:43 -0800 Subject: Changed SRV Request timeout to respond with an event instead of an error --- indra/viewer_components/login/lllogin.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index 7a30315b9a..ea1e3ff3f9 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -141,9 +141,14 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential LL_INFOS("LLLogin") << "Requesting SRV record from " << uri << LL_ENDL; // *NOTE:Mani - Completely arbitrary timeout value for SRV request. - filter.errorAfter(5, "SRV Request timed out!"); - - // Make request + // filter.errorAfter(5, "SRV Request timed out!"); + + // + F32 seconds_to_timeout = 5.0f; + filter.actionAfter(seconds_to_timeout, + sendProgressEvent("offline", "fail.login", LLSD())); + + // Make request LLSD request; request["op"] = "rewriteURI"; request["uri"] = uri; -- cgit v1.2.3 From 51e3a486c6de28eb0a722edeee685192e9bde1b2 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Wed, 11 Nov 2009 14:28:40 -0800 Subject: Changes to fix an LLERRS caused by SRV request timeout. Added settings to config SRV request params Increased timeout to 10 seconds Changed timeout to generate login failure event instead of an error. Added unit test to cover SRV failure event. --- indra/newview/app_settings/settings.xml | 24 ++++++++++++++++- indra/newview/lllogininstance.cpp | 3 +++ indra/newview/tests/lllogininstance_test.cpp | 1 + indra/viewer_components/login/lllogin.cpp | 30 ++++++++++++++++------ .../viewer_components/login/tests/lllogin_test.cpp | 29 +++++++++++++++++++++ 5 files changed, 78 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6f6d5fb979..dccf4de651 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4248,7 +4248,29 @@ Value 0 - LogMessages + LoginSRVTimeout + + Comment + Duration in seconds of the login SRV request timeout + Persist + 1 + Type + F32 + Value + 10.0 + + LoginSRVPump + + Comment + Name of the message pump that handles SRV request + Persist + 1 + Type + String + Value + LLAres + + LogMessages Comment Log network traffic diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index e5f347ddc4..955347bce2 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -182,6 +182,9 @@ void LLLoginInstance::constructAuthParams(const LLSD& credentials) mRequestData["method"] = "login_to_simulator"; mRequestData["params"] = request_params; mRequestData["options"] = requested_options; + + mRequestData["cfg_srv_timeout"] = gSavedSettings.getF32("LoginSRVTimeout"); + mRequestData["cfg_srv_pump"] = gSavedSettings.getString("LoginSRVPump"); } bool LLLoginInstance::handleLoginEvent(const LLSD& event) diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp index d31a81e128..7b28a3b72c 100644 --- a/indra/newview/tests/lllogininstance_test.cpp +++ b/indra/newview/tests/lllogininstance_test.cpp @@ -76,6 +76,7 @@ LLControlGroup::LLControlGroup(const std::string& name) : LLControlGroup::~LLControlGroup() {} void LLControlGroup::setBOOL(const std::string& name, BOOL val) {} BOOL LLControlGroup::getBOOL(const std::string& name) { return FALSE; } +F32 LLControlGroup::getF32(const std::string& name) { return 0.0f; } U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only) { return 1; } void LLControlGroup::setString(const std::string& name, const std::string& val) {} std::string LLControlGroup::getString(const std::string& name) { return "test_string"; } diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp index ea1e3ff3f9..b14c59ab9a 100644 --- a/indra/viewer_components/login/lllogin.cpp +++ b/indra/viewer_components/login/lllogin.cpp @@ -70,7 +70,7 @@ public: LLEventPump& getEventPump() { return mPump; } private: - void sendProgressEvent(const std::string& state, const std::string& change, + LLSD getProgressEventLLSD(const std::string& state, const std::string& change, const LLSD& data = LLSD()) { LLSD status_data; @@ -87,7 +87,13 @@ private: { status_data["data"] = data; } + return status_data; + } + void sendProgressEvent(const std::string& state, const std::string& change, + const LLSD& data = LLSD()) + { + LLSD status_data = getProgressEventLLSD(state, change, data); mPump.post(status_data); } @@ -140,20 +146,28 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential // Request SRV record. LL_INFOS("LLLogin") << "Requesting SRV record from " << uri << LL_ENDL; - // *NOTE:Mani - Completely arbitrary timeout value for SRV request. - // filter.errorAfter(5, "SRV Request timed out!"); - - // + // *NOTE:Mani - Completely arbitrary default timeout value for SRV request. F32 seconds_to_timeout = 5.0f; - filter.actionAfter(seconds_to_timeout, - sendProgressEvent("offline", "fail.login", LLSD())); + if(credentials.has("cfg_srv_timeout")) + { + seconds_to_timeout = credentials["cfg_srv_timeout"].asReal(); + } + + filter.eventAfter(seconds_to_timeout, + getProgressEventLLSD("offline", "fail.login")); + + std::string srv_pump_name = "LLAres"; + if(credentials.has("cfg_srv_pump")) + { + srv_pump_name = credentials["cfg_srv_pump"].asString(); + } // Make request LLSD request; request["op"] = "rewriteURI"; request["uri"] = uri; request["reply"] = replyPump.getName(); - rewrittenURIs = postAndWait(self, request, "LLAres", filter); + rewrittenURIs = postAndWait(self, request, srv_pump_name, filter); } // we no longer need the filter LLEventPump& xmlrpcPump(LLEventPumps::instance().obtain("LLXMLRPCTransaction")); diff --git a/indra/viewer_components/login/tests/lllogin_test.cpp b/indra/viewer_components/login/tests/lllogin_test.cpp index a8ae2883d5..c3b1838422 100644 --- a/indra/viewer_components/login/tests/lllogin_test.cpp +++ b/indra/viewer_components/login/tests/lllogin_test.cpp @@ -47,6 +47,7 @@ public: bool call(const LLSD& event) { mDebug(STRINGIZE("LoginListener called!: " << event)); + mLastEvent = event; return false; } @@ -414,4 +415,32 @@ namespace tut ensure_equals("Failed to offline", listener.lastEvent()["state"].asString(), "offline"); } + + template<> template<> + void llviewerlogin_object::test<5>() + { + DEBUG; + // Test SRV request timeout. + set_test_name("LLLogin SRV timeout testing"); + + // Testing normal login procedure. + LLEventStream llaresPump("LLAres"); // Dummy LLAres pump. + + // LLAresListener dummyLLAres("dummy_llares"); + // dummyLLAres.listenTo(llaresPump); + + LLLogin login; + LoginListener listener("test_ear"); + listener.listenTo(login.getEventPump()); + + LLSD credentials; + credentials["first"] = "these"; + credentials["last"] = "don't"; + credentials["passwd"] = "matter"; + credentials["cfg_srv_timeout"] = 0.0f; + + login.connect("login.bar.com", credentials); + + ensure_equals("Failed to offline", listener.lastEvent()["change"].asString(), "srvrequest"); + } } -- cgit v1.2.3 From f9f2852ff2d1b11b3bba5811192ccb89c9354877 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Thu, 12 Nov 2009 09:19:32 -0800 Subject: DEV-42715 Fixed lllogin SRV request timeout unit test. Also made SRV config options not persistent. reviewed by brad --- indra/newview/app_settings/settings.xml | 4 ++-- indra/viewer_components/login/tests/lllogin_test.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index dccf4de651..a530b800a3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4253,7 +4253,7 @@ Comment Duration in seconds of the login SRV request timeout Persist - 1 + 0 Type F32 Value @@ -4264,7 +4264,7 @@ Comment Name of the message pump that handles SRV request Persist - 1 + 0 Type String Value diff --git a/indra/viewer_components/login/tests/lllogin_test.cpp b/indra/viewer_components/login/tests/lllogin_test.cpp index c3b1838422..56c21016bd 100644 --- a/indra/viewer_components/login/tests/lllogin_test.cpp +++ b/indra/viewer_components/login/tests/lllogin_test.cpp @@ -441,6 +441,14 @@ namespace tut login.connect("login.bar.com", credentials); - ensure_equals("Failed to offline", listener.lastEvent()["change"].asString(), "srvrequest"); + ensure_equals("SRV State", listener.lastEvent()["change"].asString(), "srvrequest"); + + // Get the mainloop eventpump, which needs a pinging in order to drive the + // SRV timeout. + LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop")); + LLSD frame_event; + mainloop.post(frame_event); + + ensure_equals("SRV Failure", listener.lastEvent()["change"].asString(), "fail.login"); } } -- cgit v1.2.3