From d4f6750f8214dea3816b3496c73aef8829423168 Mon Sep 17 00:00:00 2001 From: diva Date: Wed, 1 Apr 2009 01:18:21 +0000 Subject: Added AllowLoginWithoutInventory to LoginService, to be overwritten in subclasses. Default is false. HGLoginAuthService sets it true. Better error handling dealing with inventory service faults. --- .../Communications/Services/LoginService.cs | 41 ++++++++++++++++------ 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'OpenSim/Framework/Communications/Services/LoginService.cs') diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs index 1b6520d..d9556e4 100644 --- a/OpenSim/Framework/Communications/Services/LoginService.cs +++ b/OpenSim/Framework/Communications/Services/LoginService.cs @@ -197,7 +197,7 @@ namespace OpenSim.Framework.Communications.Services try { UUID agentID = userProfile.ID; - InventoryData inventData; + InventoryData inventData = null; try { @@ -209,16 +209,24 @@ namespace OpenSim.Framework.Communications.Services "[LOGIN END]: Error retrieving inventory skeleton of agent {0} - {1}", agentID, e); - return logResponse.CreateLoginInventoryFailedResponse(); + // Let's not panic + if (!AllowLoginWithoutInventory()) + return logResponse.CreateLoginInventoryFailedResponse(); } - ArrayList AgentInventoryArray = inventData.InventoryArray; + if (inventData != null) + { + ArrayList AgentInventoryArray = inventData.InventoryArray; - Hashtable InventoryRootHash = new Hashtable(); - InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString(); - ArrayList InventoryRoot = new ArrayList(); - InventoryRoot.Add(InventoryRootHash); - userProfile.RootInventoryFolderID = inventData.RootFolderID; + Hashtable InventoryRootHash = new Hashtable(); + InventoryRootHash["folder_id"] = inventData.RootFolderID.ToString(); + ArrayList InventoryRoot = new ArrayList(); + InventoryRoot.Add(InventoryRootHash); + userProfile.RootInventoryFolderID = inventData.RootFolderID; + + logResponse.InventoryRoot = InventoryRoot; + logResponse.InventorySkeleton = AgentInventoryArray; + } // Inventory Library Section Hashtable InventoryLibRootHash = new Hashtable(); @@ -228,8 +236,6 @@ namespace OpenSim.Framework.Communications.Services logResponse.InventoryLibRoot = InventoryLibRoot; logResponse.InventoryLibraryOwner = GetLibraryOwner(); - logResponse.InventoryRoot = InventoryRoot; - logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventoryLibrary = GetInventoryLibrary(); logResponse.CircuitCode = Util.RandomClass.Next(); @@ -1011,7 +1017,15 @@ namespace OpenSim.Framework.Communications.Services /// protected void AddActiveGestures(LoginResponse response, UserProfileData theUser) { - List gestures = m_inventoryService.GetActiveGestures(theUser.ID); + List gestures = null; + try + { + gestures = m_inventoryService.GetActiveGestures(theUser.ID); + } + catch (Exception e) + { + m_log.Debug("[LOGIN]: Unable to retrieve active gestures from inventory server. Reason: " + e.Message); + } //m_log.DebugFormat("[LOGIN]: AddActiveGestures, found {0}", gestures == null ? 0 : gestures.Count); ArrayList list = new ArrayList(); if (gestures != null) @@ -1089,5 +1103,10 @@ namespace OpenSim.Framework.Communications.Services return new InventoryData(AgentInventoryArray, rootID); } + + protected virtual bool AllowLoginWithoutInventory() + { + return false; + } } } -- cgit v1.1