From 39165f3de4e4a207e4461a8d94acaff611dd9873 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Tue, 15 Apr 2008 18:10:42 +0000 Subject: * Send a meaningful response to both the user server console and the client if a login fails because the inventory service has failed. --- OpenSim/Framework/Communications/LoginResponse.cs | 13 +++++++ OpenSim/Framework/Communications/LoginService.cs | 41 ++++++++++++++++------- 2 files changed, 41 insertions(+), 13 deletions(-) (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs index 763274a..53ec796 100644 --- a/OpenSim/Framework/Communications/LoginResponse.cs +++ b/OpenSim/Framework/Communications/LoginResponse.cs @@ -238,6 +238,19 @@ namespace OpenSim.Framework.UserManagement "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "false"); } + + /// + /// Response to indicate that login failed because the agent's inventory was not available. + /// + /// + public XmlRpcResponse CreateLoginInventoryFailedResponse() + { + return GenerateFailureResponse( + "key", + "The agent inventory service is not responding. Please notify the grid operator if this is a grid sim," + + " or the sim operator if this is a standalone sim.", + "false"); + } public XmlRpcResponse CreateAlreadyLoggedInResponse() { diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index afe7359..f8ac75e 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -84,6 +84,7 @@ namespace OpenSim.Framework.UserManagement /// /// /// + /// This will be thrown if there is a problem with the inventory service protected abstract InventoryData GetInventorySkeleton(LLUUID userID); /// @@ -208,9 +209,20 @@ namespace OpenSim.Framework.UserManagement try { LLUUID agentID = userProfile.ID; - - // Inventory Library Section - InventoryData inventData = GetInventorySkeleton(agentID); + InventoryData inventData = null; + + try + { + inventData = GetInventorySkeleton(agentID); + } + catch (System.Net.WebException e) + { + m_log.ErrorFormat( + "[LOGIN]: Error retrieving inventory skeleton of agent {0}, {1} - {2}", agentID, e.GetType(), e.Message); + + return logResponse.CreateLoginInventoryFailedResponse(); + } + ArrayList AgentInventoryArray = inventData.InventoryArray; Hashtable InventoryRootHash = new Hashtable(); @@ -218,7 +230,20 @@ namespace OpenSim.Framework.UserManagement ArrayList InventoryRoot = new ArrayList(); InventoryRoot.Add(InventoryRootHash); userProfile.RootInventoryFolderID = inventData.RootFolderID; + + // Inventory Library Section + Hashtable InventoryLibRootHash = new Hashtable(); + InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; + ArrayList InventoryLibRoot = new ArrayList(); + InventoryLibRoot.Add(InventoryLibRootHash); + logResponse.InventoryLibRoot = InventoryLibRoot; + logResponse.InventoryLibraryOwner = GetLibraryOwner(); + + logResponse.InventoryRoot = InventoryRoot; + logResponse.InventorySkeleton = AgentInventoryArray; + logResponse.InventoryLibrary = GetInventoryLibrary(); + // Circuit Code uint circode = (uint) (Util.RandomClass.Next()); @@ -227,17 +252,7 @@ namespace OpenSim.Framework.UserManagement logResponse.AgentID = agentID.ToString(); logResponse.SessionID = userProfile.CurrentAgent.SessionID.ToString(); logResponse.SecureSessionID = userProfile.CurrentAgent.SecureSessionID.ToString(); - logResponse.InventoryRoot = InventoryRoot; - logResponse.InventorySkeleton = AgentInventoryArray; - logResponse.InventoryLibrary = GetInventoryLibrary(); - Hashtable InventoryLibRootHash = new Hashtable(); - InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; - ArrayList InventoryLibRoot = new ArrayList(); - InventoryLibRoot.Add(InventoryLibRootHash); - logResponse.InventoryLibRoot = InventoryLibRoot; - - logResponse.InventoryLibraryOwner = GetLibraryOwner(); logResponse.CircuitCode = (Int32) circode; //logResponse.RegionX = 0; //overwritten //logResponse.RegionY = 0; //overwritten -- cgit v1.1