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/HGLoginAuthService.cs | 6 ++++ .../Communications/Services/LoginResponse.cs | 9 ++--- .../Communications/Services/LoginService.cs | 41 ++++++++++++++++------ 3 files changed, 41 insertions(+), 15 deletions(-) (limited to 'OpenSim/Framework/Communications/Services') diff --git a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs index 99fbb2b..5e357d5 100644 --- a/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs +++ b/OpenSim/Framework/Communications/Services/HGLoginAuthService.cs @@ -324,5 +324,11 @@ namespace OpenSim.Framework.Communications.Services m_regionsConnector.LogOffUserFromGrid(SimInfo.RegionHandle, theUser.ID, theUser.CurrentAgent.SecureSessionID, "Logging you off"); } + + protected override bool AllowLoginWithoutInventory() + { + return true; + } + } } diff --git a/OpenSim/Framework/Communications/Services/LoginResponse.cs b/OpenSim/Framework/Communications/Services/LoginResponse.cs index db208a4..c81febd 100644 --- a/OpenSim/Framework/Communications/Services/LoginResponse.cs +++ b/OpenSim/Framework/Communications/Services/LoginResponse.cs @@ -371,9 +371,12 @@ namespace OpenSim.Framework.Communications.Services responseData["classified_categories"] = classifiedCategories; responseData["ui-config"] = uiConfig; - responseData["inventory-skeleton"] = agentInventory; + if (agentInventory != null) + { + responseData["inventory-skeleton"] = agentInventory; + responseData["inventory-root"] = inventoryRoot; + } responseData["inventory-skel-lib"] = inventoryLibrary; - responseData["inventory-root"] = inventoryRoot; responseData["inventory-lib-root"] = inventoryLibRoot; responseData["gestures"] = activeGestures; responseData["inventory-lib-owner"] = inventoryLibraryOwner; @@ -386,8 +389,6 @@ namespace OpenSim.Framework.Communications.Services responseData["region_x"] = (Int32)(RegionX * Constants.RegionSize); responseData["region_y"] = (Int32)(RegionY * Constants.RegionSize); - //responseData["inventory-lib-root"] = new ArrayList(); // todo - if (m_buddyList != null) { responseData["buddy-list"] = m_buddyList.ToArray(); 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